Bug 44041 - az6007.c: bad call to memcpy
Summary: az6007.c: bad call to memcpy
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(Other) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Alan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-01 12:08 UTC by David Binderman
Modified: 2012-08-15 21:53 UTC (History)
2 users (show)

See Also:
Kernel Version: 3.5-rc5
Subsystem:
Regression: No
Bisected commit-id:


Attachments

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

Note You need to log in before you can comment on or make changes to this bug.