staging: bcm: nvm.c: Cleaning up a array that is filled incompletely
authorRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Sun, 8 Jun 2014 21:45:28 +0000 (23:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Jun 2014 00:03:29 +0000 (17:03 -0700)
Array 'SigBuff' is filled incompletely.
Someone forget to multiply for the sizeof type.

This was partly found using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/bcm/nvm.c

index 63be3be62ebd9b0fc1093109b0ad9c8b085bfc42..d56ca3b06b60fe23c876d3f99c2474c67b7db091 100644 (file)
@@ -3591,7 +3591,7 @@ int BcmCopyISO(struct bcm_mini_adapter *Adapter, struct bcm_flash2x_copy_section
 
                        if (IsThisHeaderSector == TRUE) {
                                /* If this is header sector write 0xFFFFFFFF at the sig time and in last write sig */
-                               memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE);
+                               memcpy(SigBuff, Buff + sigOffset, sizeof(SigBuff));
 
                                for (i = 0; i < MAX_RW_SIZE; i++)
                                        *(Buff + sigOffset + i) = 0xFF;
@@ -3704,7 +3704,7 @@ int BcmCopyISO(struct bcm_mini_adapter *Adapter, struct bcm_flash2x_copy_section
 
                        if (IsThisHeaderSector == TRUE) {
                                /* If this is header sector write 0xFFFFFFFF at the sig time and in last write sig */
-                               memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE);
+                               memcpy(SigBuff, Buff + sigOffset, sizeof(SigBuff));
 
                                for (i = 0; i < MAX_RW_SIZE; i++)
                                        *(Buff + sigOffset + i) = 0xFF;