From: Wei Liu <wei.liu@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Stefano Garzarella <sgarzare@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] hv_sock: Extract hvs_send_data() helper that takes only header
Date: Tue, 7 Dec 2021 12:03:33 +0000 [thread overview]
Message-ID: <20211207120333.rmq3mmla5js7kpuj@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <20211207063217.2591451-1-keescook@chromium.org>
On Mon, Dec 06, 2021 at 10:32:17PM -0800, Kees Cook wrote:
> When building under -Warray-bounds, the compiler is especially
> conservative when faced with casts from a smaller object to a larger
> object. While this has found many real bugs, there are some cases that
> are currently false positives (like here). With this as one of the last
> few instances of the warning in the kernel before -Warray-bounds can be
> enabled globally, rearrange the functions so that there is a header-only
> version of hvs_send_data(). Silences this warning:
>
> net/vmw_vsock/hyperv_transport.c: In function 'hvs_shutdown_lock_held.constprop':
> net/vmw_vsock/hyperv_transport.c:231:32: warning: array subscript 'struct hvs_send_buf[0]' is partly outside array bounds of 'struct vmpipe_proto_header[1]' [-Warray-bounds]
> 231 | send_buf->hdr.pkt_type = 1;
> | ~~~~~~~~~~~~~~~~~~~~~~~^~~
> net/vmw_vsock/hyperv_transport.c:465:36: note: while referencing 'hdr'
> 465 | struct vmpipe_proto_header hdr;
> | ^~~
>
> This change results in no executable instruction differences.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Wei Liu <wei.liu@kernel.org>
next prev parent reply other threads:[~2021-12-07 12:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-07 6:32 [PATCH] hv_sock: Extract hvs_send_data() helper that takes only header Kees Cook
2021-12-07 12:03 ` Wei Liu [this message]
2021-12-08 6:10 ` 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=20211207120333.rmq3mmla5js7kpuj@liuwe-devbox-debian-v2 \
--to=wei.liu@kernel.org \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sgarzare@redhat.com \
--cc=sthemmin@microsoft.com \
--cc=virtualization@lists.linux-foundation.org \
/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