All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Kees Cook <keescook@chromium.org>
Cc: M Chetan Kumar <m.chetan.kumar@intel.com>,
	Florian Klink <flokli@flokli.de>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	Intel Corporation <linuxwwan@intel.com>,
	Loic Poulain <loic.poulain@linaro.org>,
	Sergey Ryazanov <ryazanov.s.a@gmail.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] net: wwan: iosm: Convert single instance struct member to flexible array
Date: Wed, 21 Jun 2023 16:49:58 +0200	[thread overview]
Message-ID: <ZJMOFnpONApGxOKi@corigine.com> (raw)
In-Reply-To: <20230620194234.never.023-kees@kernel.org>

On Tue, Jun 20, 2023 at 12:42:38PM -0700, Kees Cook wrote:
> struct mux_adth actually ends with multiple struct mux_adth_dg members.
> This is seen both in the comments about the member:
> 
> /**
>  * struct mux_adth - Structure of the Aggregated Datagram Table Header.
>  ...
>  * @dg:		datagramm table with variable length
>  */
> 
> and in the preparation for populating it:
> 
>                         adth_dg_size = offsetof(struct mux_adth, dg) +
>                                         ul_adb->dg_count[i] * sizeof(*dg);
> 			...
>                         adth_dg_size -= offsetof(struct mux_adth, dg);
>                         memcpy(&adth->dg, ul_adb->dg[i], adth_dg_size);
> 
> This was reported as a run-time false positive warning:
> 
> memcpy: detected field-spanning write (size 16) of single field "&adth->dg" at drivers/net/wwan/iosm/iosm_ipc_mux_codec.c:852 (size 8)
> 
> Adjust the struct mux_adth definition and associated sizeof() math; no binary
> output differences are observed in the resulting object file.
> 
> Reported-by: Florian Klink <flokli@flokli.de>
> Closes: https://lore.kernel.org/lkml/dbfa25f5-64c8-5574-4f5d-0151ba95d232@gmail.com/
> Fixes: 1f52d7b62285 ("net: wwan: iosm: Enable M.2 7360 WWAN card support")
> Cc: M Chetan Kumar <m.chetan.kumar@intel.com>
> Cc: Bagas Sanjaya <bagasdotme@gmail.com>
> Cc: Intel Corporation <linuxwwan@intel.com>
> Cc: Loic Poulain <loic.poulain@linaro.org>
> Cc: Sergey Ryazanov <ryazanov.s.a@gmail.com>
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Paolo Abeni <pabeni@redhat.com>
> Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/net/wwan/iosm/iosm_ipc_mux_codec.c | 15 ++++++---------
>  drivers/net/wwan/iosm/iosm_ipc_mux_codec.h |  2 +-
>  2 files changed, 7 insertions(+), 10 deletions(-)

Reviewed-by: Simon Horman <simon.horman@corigine.com>


  parent reply	other threads:[~2023-06-21 14:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 19:42 [PATCH] net: wwan: iosm: Convert single instance struct member to flexible array Kees Cook
2023-06-20 21:17 ` Gustavo A. R. Silva
2023-06-21 14:49 ` Simon Horman [this message]
2023-06-22  9:40 ` patchwork-bot+netdevbpf

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=ZJMOFnpONApGxOKi@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=bagasdotme@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=flokli@flokli.de \
    --cc=gustavoars@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxwwan@intel.com \
    --cc=loic.poulain@linaro.org \
    --cc=m.chetan.kumar@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ryazanov.s.a@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.