[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d8884b3c-bef4-7042-934b-0bcdb4347b97@ispras.ru>
Date: Mon, 8 Jan 2024 20:28:31 +0300
From: Alexey Khoroshilov <khoroshilov@...ras.ru>
To: Andrey Shumilin <shum.sdl@...ct.ru>, 3chas3@...il.com
Cc: linux-atm-general@...ts.sourceforge.net, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: [PATCH] iphase: Adding a null pointer check
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@...ct.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
Powered by blists - more mailing lists