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:   Sun, 11 Apr 2021 16:28:31 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Alex Elder <elder@...aro.org>
Cc:     davem@...emloft.net, kuba@...nel.org, bjorn.andersson@...aro.org,
        evgreen@...omium.org, cpratapa@...eaurora.org,
        subashab@...eaurora.org, elder@...nel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 4/7] net: ipa: ipa_stop() does not return an
 error

On Sun, Apr 11, 2021 at 08:09:55AM -0500, Alex Elder wrote:
> On 4/11/21 1:34 AM, Leon Romanovsky wrote:
> > On Fri, Apr 09, 2021 at 01:07:19PM -0500, Alex Elder wrote:
> >> In ipa_modem_stop(), if the modem netdev pointer is non-null we call
> >> ipa_stop().  We check for an error and if one is returned we handle
> >> it.  But ipa_stop() never returns an error, so this extra handling
> >> is unnecessary.  Simplify the code in ipa_modem_stop() based on the
> >> knowledge no error handling is needed at this spot.
> >>
> >> Signed-off-by: Alex Elder <elder@...aro.org>
> >> ---
> >>  drivers/net/ipa/ipa_modem.c | 18 ++++--------------
> >>  1 file changed, 4 insertions(+), 14 deletions(-)
> > 
> > <...>
> > 
> >> +	/* Stop the queue and disable the endpoints if it's open */
> >>  	if (netdev) {
> >> -		/* Stop the queue and disable the endpoints if it's open */
> >> -		ret = ipa_stop(netdev);
> >> -		if (ret)
> >> -			goto out_set_state;
> >> -
> >> +		(void)ipa_stop(netdev);
> > 
> > This void casting is not needed here and in more general case sometimes
> > even be seen as a mistake, for example if the returned attribute declared
> > as __must_check.
> 
> I accept your point but I feel like it's sort of a 50/50 thing.
> 
> I think *not* checking an available return value is questionable
> practice.  I'd really rather have a build option for a
> "__need_not_check" tag and have "must_check" be the default.

__need_not_check == void ???

> 
> The void cast here says "I know this returns a result, but I am
> intentionally not checking it."  If it had been __must_check I
> would certainly have checked it.  
> 
> That being said, I don't really care that much, so I'll plan
> to post version 2, which will drop this cast (I'll probably
> add a comment though).

Thanks

> 
> Thanks.
> 
> 					-Alex
> 
> > 
> > Thanks
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ