Bug 46891

Summary: [CHECK]scsi/bnx2fc/bnx2fc_io.c:1810: bad call to memset
Product: SCSI Drivers Reporter: David Binderman (dcb314)
Component: OtherAssignee: scsi_drivers-other
Status: CLOSED CODE_FIX    
Severity: normal CC: alan, bprakash
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.6-rc4 Subsystem:
Regression: No Bisected commit-id:

Description David Binderman 2012-09-02 14:55:41 UTC
I just tried to compile linux-3.6-rc4 with a recent snapshot
of the gcc compiler. It said

drivers/scsi/bnx2fc/bnx2fc_io.c:1810:41: warning: argument to ‘sizeof’ in ‘memset’ call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]

The source code is

        memset(sc_cmd->sense_buffer, 0, sizeof(sc_cmd->sense_buffer));

maybe 

        memset(sc_cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);

might be better.
Comment 1 Alan 2012-09-03 15:36:01 UTC
Yes this does appear to be the case - the warning is confusing though.
Comment 2 Bhanu Prakash Gollapudi 2012-09-03 15:53:51 UTC
Agree. I'll fix this soon.