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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181015093708.GA22876@mail.gnudd.com>
Date:   Mon, 15 Oct 2018 11:37:08 +0200
From:   Alessandro Rubini <rubini@...dd.com>
To:     uwe@...ine-koenig.org
Cc:     gregkh@...uxfoundation.org, corbet@....net,
        linux-kernel@...r.kernel.org, thierry.reding@...il.com,
        Michal.Vokac@...ft.com, akpm@...ux-foundation.org,
        kernel@...gutronix.de
Subject: Re: [PATCH RFC] err.h: document that PTR_ERR should only be used if
 IS_ERR returns true

Hello.

> during a review I claimed that PTR_ERR should only be used if IS_ERR was
> already checked. The rationale isn't obvious though and Thierry
> suggested to keep the code as is and not introduce an IS_ERR check.

The rationale is the same ch11 you linked to: "any other value
is a valid pointer".  It isn't usefult to convert to long sth that
your are not using as a long.  You should not pass it to strerror(-err)
for example.

OTOH I admit you can compare any value with -EINVAL, after PTR_ERR.
But in general you first detect the error condition and then split
among error (or print a message according to the exact value.

> maybe something like "On an Alpha it is important because
> not doing it results in a bus error there."

No, nothing that exotic.

You said:

> Thierry suggested to keep the code as is and not introduce an IS_ERR check.

I wonder where. Sure no extra check in the header, that would be
extra wasted time in every caller. If it's a specific caller place,
it may make sense to avoid the check, I don't know the details.

As for the specific patch you propose, I'm unsure it's useful.  Maybe
we should remember that "this returns the equivalent of "-errno" if
IS_ERR() is true", but I'm personally not much for overcommenting:
It's a simple cast and there are a zillion users to see how exactly
this works if anyone is uncertain.

Regards
/alessandro

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ