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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 11 May 2019 13:28:13 +0530
From:   Hariprasad Kelam <hariprasad.kelam@...il.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Tim Collier <osdevtc@...il.com>,
        Chris Opperman <eklikeroomys@...il.com>,
        Hariprasad Kelam <hariprasad.kelam@...il.com>,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: wlan-ng: collect return status without variable

On Fri, May 10, 2019 at 09:40:11PM +0300, Dan Carpenter wrote:
> On Fri, May 10, 2019 at 10:53:08PM +0530, Hariprasad Kelam wrote:
> > On Fri, May 10, 2019 at 01:57:54PM +0300, Dan Carpenter wrote:
> > > On Fri, May 10, 2019 at 08:09:00AM +0530, Hariprasad Kelam wrote:
> > > > diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
> > > > index 8a862f7..5dad5ac 100644
> > > > --- a/drivers/staging/wlan-ng/cfg80211.c
> > > > +++ b/drivers/staging/wlan-ng/cfg80211.c
> > > > @@ -231,17 +231,12 @@ static int prism2_set_default_key(struct wiphy *wiphy, struct net_device *dev,
> > > >  {
> > > >  	struct wlandevice *wlandev = dev->ml_priv;
> > > >  
> > > > -	int err = 0;
> > > > -	int result = 0;
> > > > -
> > > > -	result = prism2_domibset_uint32(wlandev,
> > > > -		DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
> > > > -		key_index);
> > > > -
> > > > -	if (result)
> > > > -		err = -EFAULT;
> > > > -
> > > > -	return err;
> > > > +	if (prism2_domibset_uint32(wlandev,
> > > > +				   DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
> > > > +				   key_index))
> > > > +		return -EFAULT;
> > > > +	else
> > > > +		return 0;
> > > 
> > > We should just preserve the error codes from prism2_domibset_uint32().
> > > 
> > > 	return prism2_domibset_uint32(dev->ml_priv,
> > > 				DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
> > > 				key_index);
> > >
> >    prism2_domibset_uint32 function can return  -ENODEV,-EPERM,-EBUSY if
> >    fail  case.
> > 
> >    If we observe the pattern of calling this function,we can find
> >    
> >    "return -EFAULT on failure and 0 on success".
> > 
> >    Due to this we  can not collect return status directly.
> 
> Yes, I know this code is full of nonsense.
> 
> It shouldn't just always return -EFAULT, it should preserve the correct
> error code.  This is only called from rdev_set_default_key() if you want
> to check the caller.
> 
> regards,
> dan carpenter
 Yes , Caller not particular about -EFAULT,there is no
 need of masking all errors with EFAULT in  fail case. 

 We can directly collect the return status.
 Will  resend the patch with suggested changes

 Thanks,
 Hariprasad k

Powered by blists - more mailing lists