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]
Date:   Thu, 25 Mar 2021 01:24:23 +0500
From:   Muhammad Usama Anjum <musamaanjum@...il.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
        alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org, colin.king@...onical.com
Subject: Re: [PATCH] ALSA: usb-audio: Fix missing return assignment

On Wed, 2021-03-24 at 21:50 +0300, Dan Carpenter wrote:
> On Wed, Mar 24, 2021 at 10:26:04PM +0500, Muhammad Usama Anjum wrote:
> > Return value of usb_driver_claim_interface should not be ignored.
> > Instead it should be stored in err variable and returned from
> > this function.
> > 
> > Signed-off-by: Muhammad Usama Anjum <musamaanjum@...il.com>
> > ---
> >  sound/usb/quirks.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
> > index 9e5e37eff10e..dd32ceaef18a 100644
> > --- a/sound/usb/quirks.c
> > +++ b/sound/usb/quirks.c
> > @@ -427,10 +427,10 @@ static int create_autodetect_quirks(struct snd_usb_audio *chip,
> >  
> >  		err = create_autodetect_quirk(chip, iface, driver);
> >  		if (err >= 0)
> 
> create_autodetect_quirk() never returns positive values.  Flip this
> condition.  (Always do error handling, don't do success handling).
> 
> 		if (err)
> 			continue;

Got it. I'll send a patch.
> 
> 
> > -			usb_driver_claim_interface(driver, iface, (void *)-1L);
> > +			err = usb_driver_claim_interface(driver, iface, (void *)-1L);
> 
> This is in a loop so only the last return value is used.  Which seems
> sort of weird and pointless that the last value would matter more than
> the others.
> 
Correct. Lets not store the return value. To stop the static analyzers
to report the missing return assignment, can we add (void) in start of
this function call? I've not seen use of (void) this way in the
kernel. Is there any other way used in the kernel?

> >  	}
> >  
> > -	return 0;
> > +	return err;
> 
> regards,
> dan carpenter
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ