From: Doug Ledford <dledford@redhat.com>
To: Nicholas Mc Guire <hofrat@osadl.org>
Cc: Hoang-Nam Nguyen <hnguyen@de.ibm.com>,
Christoph Raisch <raisch@de.ibm.com>,
Sean Hefty <sean.hefty@intel.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
Dan Carpenter <dan.carpenter@oracle.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] IB/ehca: use correct destination for memcpy
Date: Mon, 11 May 2015 17:09:40 -0400 [thread overview]
Message-ID: <1431378580.2407.528.camel@redhat.com> (raw)
In-Reply-To: <1431355082-29290-1-git-send-email-hofrat@osadl.org>
[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]
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 <dan.carpenter@oracle.com>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
>
> 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
> CONFIG_INFINIBAND_EHCA=m)
>
> Patch is against 4.1-rc3 (localversion-next is -next-20150511)
Applied, thanks.
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: 0E572FDD
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2015-05-11 21:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 14:38 [PATCH] IB/ehca: use correct destination for memcpy Nicholas Mc Guire
2015-05-11 21:09 ` Doug Ledford [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431378580.2407.528.camel@redhat.com \
--to=dledford@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=hal.rosenstock@gmail.com \
--cc=hnguyen@de.ibm.com \
--cc=hofrat@osadl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=raisch@de.ibm.com \
--cc=sean.hefty@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox