From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Oleg Sviridov <oleg.sviridov@red-soft.ru>,
Nicholas Piggin <npiggin@gmail.com>
Cc: Daniel Henrique Barboza <danielhb413@gmail.com>,
David Gibson <david@gibson.dropbear.id.au>,
Harsh Prateek Bora <harshpb@linux.ibm.com>,
Jason Wang <jasowang@redhat.com>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v2] hw/net: prevent potential NULL dereference
Date: Mon, 1 Jul 2024 17:02:23 +0200 [thread overview]
Message-ID: <73a64211-0fc0-45e4-bf11-083497d32c40@linaro.org> (raw)
In-Reply-To: <20240531073636.3779559-1-oleg.sviridov@red-soft.ru>
On 31/5/24 09:36, Oleg Sviridov wrote:
> Pointer, returned from function 'spapr_vio_find_by_reg', may be NULL and is dereferenced immediately after.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Oleg Sviridov <oleg.sviridov@red-soft.ru>
> ---
> v2: Debug message added
> hw/net/spapr_llan.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
> index ecb30b7c76..8af33d91b6 100644
> --- a/hw/net/spapr_llan.c
> +++ b/hw/net/spapr_llan.c
> @@ -770,6 +770,12 @@ static target_ulong h_change_logical_lan_mac(PowerPCCPU *cpu,
> SpaprVioVlan *dev = VIO_SPAPR_VLAN_DEVICE(sdev);
> int i;
>
> + if (!dev) {
> + hcall_dprintf("H_CHANGE_LOGICAL_LAN_MAC called when "
> + "no NIC is present\n");
> + return H_PARAMETER;
> + }
> +
> for (i = 0; i < ETH_ALEN; i++) {
> dev->nicconf.macaddr.a[ETH_ALEN - i - 1] = macaddr & 0xff;
> macaddr >>= 8;
Thanks, patch queued.
prev parent reply other threads:[~2024-07-01 15:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 11:07 [PATCH] hw/net: prevent potential NULL dereference Oleg Sviridov
2024-05-29 13:52 ` Philippe Mathieu-Daudé
2024-05-30 14:38 ` Олег Свиридов
2024-05-30 0:29 ` David Gibson
2024-05-30 9:03 ` Peter Maydell
2024-05-31 4:52 ` David Gibson
2024-05-31 7:36 ` [PATCH v2] " Oleg Sviridov
2024-07-01 15:02 ` Philippe Mathieu-Daudé [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=73a64211-0fc0-45e4-bf11-083497d32c40@linaro.org \
--to=philmd@linaro.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=harshpb@linux.ibm.com \
--cc=jasowang@redhat.com \
--cc=npiggin@gmail.com \
--cc=oleg.sviridov@red-soft.ru \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.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;
as well as URLs for NNTP newsgroup(s).