[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220315115536.GN3293@kadam>
Date: Tue, 15 Mar 2022 14:55:36 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Meng Tang <tangmeng@...ontech.com>
Cc: t.sailer@...mni.ethz.ch, davem@...emloft.net, kuba@...nel.org,
linux-hams@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hamradio: Fix wrong assignment of 'bbc->cfg.loopback'
On Tue, Mar 15, 2022 at 03:48:51PM +0800, Meng Tang wrote:
> In file hamradio/baycom_epp.c, the baycom_setmode interface, there
> is a problem with improper use of strstr.
>
> Suppose that when modestr="noloopback", both conditions which are
> 'strstr(modestr,"noloopback")' and 'strstr(modestr,"loopback")'
> will be true(not NULL), this lead the bc->cfg.loopback variable
> will be first assigned to 0, and then reassigned to 1.
>
> This will cause 'bc->cfg.loopback = 0' will never take effect. That
> obviously violates the logic of the code, so adjust the order of
> their execution to solve the problem.
>
> Signed-off-by: Meng Tang <tangmeng@...ontech.com>
Reviewed-by: Dan Carpenter <dan.carpenter@...cle.com>
This bug predates git. :P Did you find it by testing or reviewing the
code?
regards,
dan carpenter
Powered by blists - more mailing lists