lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZ6RqL4iznd+Hz_J02hheFF1xGRHo9nUzTNXGD=ey=GPA1WmA@mail.gmail.com>
Date:   Sun, 9 Jan 2022 01:11:12 +0900
From:   Vincent MAILHOL <mailhol.vincent@...adoo.fr>
To:     trix@...hat.com
Cc:     wg@...ndegger.com, mkl@...gutronix.de, davem@...emloft.net,
        kuba@...nel.org, nathan@...nel.org, ndesaulniers@...gle.com,
        Stefan.Maetje@....eu, linux-can@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        llvm@...ts.linux.dev
Subject: Re: [PATCH] can: janz-ican3: initialize dlc variable

On Sat. 8 Jan 2022 à 23:33, <trix@...hat.com> wrote:
> From: Tom Rix <trix@...hat.com>
>
> Clang static analysis reports this problem
> janz-ican3.c:1311:2: warning: Undefined or garbage value returned to caller
>         return dlc;
>         ^~~~~~~~~~
>
> dlc is only set with this conditional
>         if (!(cf->can_id & CAN_RTR_FLAG))
>                 dlc = cf->len;
>
> But is always returned.  So initialize dlc to 0.

Yes. The actual intent is to return a length of 0 for RTR frames.

> Fixes: cc4b08c31b5c ("can: do not increase tx_bytes statistics for RTR frames")
> Signed-off-by: Tom Rix <trix@...hat.com>
> ---
>  drivers/net/can/janz-ican3.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
> index 5b677af5f2a41..808c105cf8f7e 100644
> --- a/drivers/net/can/janz-ican3.c
> +++ b/drivers/net/can/janz-ican3.c
> @@ -1285,7 +1285,7 @@ static unsigned int ican3_get_echo_skb(struct ican3_dev *mod)
>  {
>         struct sk_buff *skb = skb_dequeue(&mod->echoq);
>         struct can_frame *cf;
> -       u8 dlc;
> +       u8 dlc = 0;
>
>         /* this should never trigger unless there is a driver bug */
>         if (!skb) {
> --
> 2.26.3

I missed that when writing the patch.

I thought that I did my due diligence by running a "make W=1"
with GCC but I did not catch the error. I should have been more
precocious and run a "make W=2".

Thank you.

Acked-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ