From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: Kang Chen <void0red@gmail.com>
Cc: <borisp@nvidia.com>, <john.fastabend@gmail.com>,
<kuba@kernel.org>, <davem@davemloft.net>, <edumazet@google.com>,
<pabeni@redhat.com>, <dirk.vandermerwe@netronome.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net/tls: refine the branch condition in tls_dev_event
Date: Fri, 17 Mar 2023 09:15:13 +0100 [thread overview]
Message-ID: <20230317081513.ktllct3rqaisummm@soft-dev3-1> (raw)
In-Reply-To: <20230317071636.1028488-1-void0red@gmail.com>
The 03/17/2023 15:16, Kang Chen wrote:
Hi,
>
> dev->tlsdev_ops may be null and cause null pointer dereference later.
In the subject of your patch, you should specify which tree is this
patch targeting. When you create the patch you can use:
git format-patch ... --subject-prefix "PATCH net" ...
>
> Fixes: eeb2efaf36c7 ("net/tls: generalize the resync callback")
> Signed-off-by: Kang Chen <void0red@gmail.com>
> ---
> net/tls/tls_device.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
> index a7cc4f9faac2..f30a8fe373c2 100644
> --- a/net/tls/tls_device.c
> +++ b/net/tls/tls_device.c
> @@ -1449,7 +1449,8 @@ static int tls_dev_event(struct notifier_block *this, unsigned long event,
> if (netif_is_bond_master(dev))
> return NOTIFY_DONE;
> if ((dev->features & NETIF_F_HW_TLS_RX) &&
> - !dev->tlsdev_ops->tls_dev_resync)
> + (!dev->tlsdev_ops || (dev->tlsdev_ops &&
> + !dev->tlsdev_ops->tls_dev_resync)))
This can be simply written like:
(!dev->tlvdev_ops || !dev->tlvdev_ops->tls_dev_resync)
On the second condition you know already that dev->tlvdev_ops is not
NULL.
> return NOTIFY_BAD;
>
> if (dev->tlsdev_ops &&
> --
> 2.34.1
>
--
/Horatiu
next prev parent reply other threads:[~2023-03-17 8:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-17 7:16 [PATCH] net/tls: refine the branch condition in tls_dev_event Kang Chen
2023-03-17 8:15 ` Horatiu Vultur [this message]
2023-03-17 8:33 ` [PATCH net v2] " Kang Chen
2023-03-17 9:56 ` Horatiu Vultur
2023-03-17 19:54 ` Jakub Kicinski
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=20230317081513.ktllct3rqaisummm@soft-dev3-1 \
--to=horatiu.vultur@microchip.com \
--cc=borisp@nvidia.com \
--cc=davem@davemloft.net \
--cc=dirk.vandermerwe@netronome.com \
--cc=edumazet@google.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=void0red@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox