linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] overflow: improve check_shl_overflow comment
@ 2021-04-01 16:06 Keith Busch
  2021-04-01 21:13 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Keith Busch @ 2021-04-01 16:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: Keith Busch, Jason Gunthorpe, Kees Cook

A 'false' return means the value was safely set, so the comment should
say 'true' for when it is not considered safe.

Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 include/linux/overflow.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/overflow.h b/include/linux/overflow.h
index ef74051d5cfed..0f12345c21fb5 100644
--- a/include/linux/overflow.h
+++ b/include/linux/overflow.h
@@ -235,7 +235,7 @@ static inline bool __must_check __must_check_overflow(bool overflow)
  * - 'a << s' sets the sign bit, if any, in '*d'.
  *
  * '*d' will hold the results of the attempted shift, but is not
- * considered "safe for use" if false is returned.
+ * considered "safe for use" if true is returned.
  */
 #define check_shl_overflow(a, s, d) __must_check_overflow(({		\
 	typeof(a) _a = a;						\
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] overflow: improve check_shl_overflow comment
  2021-04-01 16:06 [PATCH] overflow: improve check_shl_overflow comment Keith Busch
@ 2021-04-01 21:13 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2021-04-01 21:13 UTC (permalink / raw)
  To: Keith Busch, linux-kernel; +Cc: Kees Cook, Jason Gunthorpe

On Thu, 1 Apr 2021 09:06:29 -0700, Keith Busch wrote:
> A 'false' return means the value was safely set, so the comment should
> say 'true' for when it is not considered safe.

Oops, yes; too many inverse negatives. ;) Applied to for-next/overflow, thanks!

[1/1] overflow: Correct check_shl_overflow() comment
      https://git.kernel.org/kees/c/4578be130a64

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-01 21:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 16:06 [PATCH] overflow: improve check_shl_overflow comment Keith Busch
2021-04-01 21:13 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).