From: Alexey Khoroshilov <khoroshilov@ispras.ru>
To: Andrey Shumilin <shum.sdl@nppct.ru>, 3chas3@gmail.com
Cc: linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
Subject: Re: [PATCH] iphase: Adding a null pointer check
Date: Mon, 8 Jan 2024 20:28:31 +0300 [thread overview]
Message-ID: <d8884b3c-bef4-7042-934b-0bcdb4347b97@ispras.ru> (raw)
In-Reply-To: <20231107123600.14529-1-shum.sdl@nppct.ru>
Proposal for subject:
atm: iphase: Move check for NULL before derefence in get_desc()
On 07.11.2023 15:36, Andrey Shumilin wrote:
> The pointer <dev->desc_tbl[i].iavcc> is dereferenced on line 195.
> Further in the code, it is checked for null on line 204.
> It is proposed to add a check before dereferencing the pointer.
Line numbers in commit messages are not welcome since they are subject
for change and a reader of the message likely has other code at that
lines in his version of the file.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Andrey Shumilin <shum.sdl@nppct.ru>
> ---
> drivers/atm/iphase.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
> index 324148686953..596422fbfacc 100644
> --- a/drivers/atm/iphase.c
> +++ b/drivers/atm/iphase.c
> @@ -192,6 +192,11 @@ static u16 get_desc (IADEV *dev, struct ia_vcc *iavcc) {
> i++;
> continue;
> }
> + if (!(iavcc_r = dev->desc_tbl[i].iavcc)) {
> + printk("Fatal err, desc table vcc or skb is NULL\n");
> + i++;
> + continue;
> + }
Error message should be fixed, skb is not check for NULL here.
> ltimeout = dev->desc_tbl[i].iavcc->ltimeout;
> delta = jiffies - dev->desc_tbl[i].timestamp;
> if (delta >= ltimeout) {
>
> if (!dev->desc_tbl[i].txskb || !(iavcc_r =
dev->desc_tbl[i].iavcc))
> printk("Fatal err, desc table vcc or skb is NULL\n");
The existing check should be fixed to check for skb only.
--
Alexey
next prev parent reply other threads:[~2024-01-08 17:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-07 12:36 Andrey Shumilin
2023-11-09 2:40 ` Jakub Kicinski
2024-01-08 17:28 ` Alexey Khoroshilov [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-03-23 6:38 Andrey Shumilin
2024-03-23 16:27 ` Simon Horman
2023-11-07 11:24 Andrey Shumilin
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=d8884b3c-bef4-7042-934b-0bcdb4347b97@ispras.ru \
--to=khoroshilov@ispras.ru \
--cc=3chas3@gmail.com \
--cc=linux-atm-general@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=netdev@vger.kernel.org \
--cc=shum.sdl@nppct.ru \
/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
all inboxes | Powered by JetHome®