Bug 44041

Summary: az6007.c: bad call to memcpy
Product: Drivers Reporter: David Binderman (dcb314)
Component: Video(Other)Assignee: Alan (alan)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, florian
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.5-rc5 Subsystem:
Regression: No Bisected commit-id:

Description David Binderman 2012-07-01 12:08:21 UTC
I just ran the static analyser "cppcheck" over the Linux kernel
source code.

It said

[linux-3.5-rc5/drivers/media/dvb/dvb-usb/az6007.c:593]: (error) Using sizeof for array given as function argument returns the size of pointer.

Source code is

    memcpy(mac, st->data, sizeof(mac));

I think you might be better off with 

    memcpy(mac, st->data, 6);
Comment 1 Alan 2012-07-02 12:50:20 UTC
Patch queued
Comment 2 Florian Mickler 2012-08-04 19:10:09 UTC
A patch referencing this bug report has been merged in Linux v3.6-rc1:

commit 5a7a570bf4205d2cc36c5abb5498df601dd828e3
Author: Alan Cox <alan@lxorguk.ukuu.org.uk>
Date:   Tue Jul 24 12:02:46 2012 -0300

    [media] az6007: fix incorrect memcpy