The size count paramters is not the same with actual buffer length in memset functions.

Bug #1838219 reported by YeHuiSheng on 2019-07-29
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Low
YeHuiSheng

Bug Description

The size count paramters is not the same with actual buffer length in memset functions.

case 1:
    In the function daemon_service_run (alarminit.cpp metal module), memset use MAX_ALARM_REQ_MSG_SIZE which is not the same with the msg actual length MAX_ALARM_REQ_SIZE.
Obviously, that is a clerical error.

               char msg [MAX_ALARM_REQ_SIZE] ;
               memset ( &msg , 0, MAX_ALARM_REQ_MSG_SIZE );
               int bytes = mtcalarm_req_sock_ptr->read((char*)&msg, MAX_ALARM_REQ_SIZE-1 );

case 2:
    In the lmonHdlr.cpp, the parameter interfaces is defined as a struct array.

               static interface_ctrl_type interfaces[INTERFACES_MAX];

    However, in the begining of funciton daemon_service_run (lmonHdlr.cpp metal module), interfaces is initialed by memset with sizeof(interface_ctrl_type), then only interfaces[0] is initialed.

               memset (&interfaces, 0, sizeof(interface_ctrl_type));

YeHuiSheng (hsye) on 2019-07-29
Changed in starlingx:
assignee: nobody → YeHuiSheng (hsye)

Fix proposed to branch: master
Review: https://review.opendev.org/673196

Changed in starlingx:
status: New → In Progress

Fix proposed to branch: master
Review: https://review.opendev.org/673198

Ghada Khalil (gkhalil) wrote :

Low priority / not gating - code cleanup suggestion w/ no noted system impact

tags: added: stx.metal
Changed in starlingx:
importance: Undecided → Low

Reviewed: https://review.opendev.org/673196
Committed: https://git.openstack.org/cgit/starlingx/metal/commit/?id=4391de7ea1e9235ebb164b811783665c98abc8f0
Submitter: Zuul
Branch: master

commit 4391de7ea1e9235ebb164b811783665c98abc8f0
Author: YeHuiSheng <email address hidden>
Date: Mon Jul 29 11:01:12 2019 +0800

    Modify the wrong size count paramter of memset in lmonHdlr.cpp

    Change-Id: Ifb72318da17bd741fe4b897d2c2ca17acf0ca6f5
    Partial-Bug: 1838219
    Signed-off-by: YeHuiSheng <email address hidden>

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers