diff mbox

media: em28xx-cards: fix em28xx_duplicate_dev()

Message ID 20180308093100.GA16525@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter March 8, 2018, 9:31 a.m. UTC
There is a double sizeof() typo here so we don't duplicate the struct
properly.

Fixes: be7fd3c3a8c5 ("media: em28xx: Hauppauge DualHD second tuner functionality")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Brad Love March 8, 2018, 2:11 p.m. UTC | #1
Hi Dan,


On 2018-03-08 03:31, Dan Carpenter wrote:
> There is a double sizeof() typo here so we don't duplicate the struct
> properly.
>
> Fixes: be7fd3c3a8c5 ("media: em28xx: Hauppauge DualHD second tuner functionality")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
> index 6e8247849c4f..6e0e67d23876 100644
> --- a/drivers/media/usb/em28xx/em28xx-cards.c
> +++ b/drivers/media/usb/em28xx/em28xx-cards.c
> @@ -3515,7 +3515,7 @@ static int em28xx_duplicate_dev(struct em28xx *dev)
>  		dev->dev_next = NULL;
>  		return -ENOMEM;
>  	}
> -	memcpy(sec_dev, dev, sizeof(sizeof(*sec_dev)));
> +	memcpy(sec_dev, dev, sizeof(*sec_dev));
>  	/* Check to see next free device and mark as used */
>  	do {
>  		nr = find_first_zero_bit(em28xx_devused, EM28XX_MAXBOARDS);


Ouch, good catch. Strangely everything still worked in 64bit builds, and
I've had no reports of wonky behaviour elsewhere.

Cheers,

Brad
diff mbox

Patch

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 6e8247849c4f..6e0e67d23876 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -3515,7 +3515,7 @@  static int em28xx_duplicate_dev(struct em28xx *dev)
 		dev->dev_next = NULL;
 		return -ENOMEM;
 	}
-	memcpy(sec_dev, dev, sizeof(sizeof(*sec_dev)));
+	memcpy(sec_dev, dev, sizeof(*sec_dev));
 	/* Check to see next free device and mark as used */
 	do {
 		nr = find_first_zero_bit(em28xx_devused, EM28XX_MAXBOARDS);