RE: [PATCH 11/12] libusbg: Replace hard coded sizes with suitable sizeof.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-
> owner@xxxxxxxxxxxxxxx] On Behalf Of David Laight
> Subject: RE: [PATCH 11/12] libusbg: Replace hard coded sizes with
> suitable sizeof.
> 
> > From: Krzysztof Opasiak
> > use sizeof to determine size of memory to copy instead of
> > using hard coded values.
> 
> ...
> > -	memcpy(&f->attr.net.dev_addr, dev_addr, 6);
> > +	memcpy(&f->attr.net.dev_addr, dev_addr, sizeof(*dev_addr));
> 
> It generally looks better if you use the size of the destination.
> Or even manage to arrange to use a structure assignment.
> 
> 	David

In this case both structures are the same type, so it doesn't matter,
but generally you are write, it's better to use destination size. I will
fix this issue in next version.

-- 
BR's
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux