[lkml]   [2015]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] IB/ehca: use correct destination for memcpy
On Mon, 2015-05-11 at 16:38 +0200, Nicholas Mc Guire wrote:
> Using an element of a struct as the address for the memcpy of the whole
> struct may introduce a buffer overflow and does not help readability either
> simply pass the real thing as first argument to memcpy.
> Reported-by: Dan Carpenter <>
> Signed-off-by: Nicholas Mc Guire <>
> ---
> passing the first element of a struct as destination triggers buffer
> overflows warnings in tools like Smatch.
> ./drivers/infiniband/hw/ehca/ehca_mcast.c:ehca_attach_mcast.80 WARNING:
> memcpy copying entire struct to first element
> ./drivers/infiniband/hw/ehca/ehca_mcast.c:ehca_detach_mcast.117 WARNING:
> memcpy copying entire struct to first element
> Simply use the structure rather than the first element (which could change)
> which also help readability.
> Patch was only compile tested with ppc64_defconfig (implies
> Patch is against 4.1-rc3 (localversion-next is -next-20150511)

Applied, thanks.

Doug Ledford <>

[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2015-05-11 23:41    [W:0.033 / U:0.352 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site