keyrings.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* key.c line 144
@ 2021-09-09 14:51 Mike Murphy
  2021-09-13 21:50 ` Ben Boeckel
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Murphy @ 2021-09-09 14:51 UTC (permalink / raw)
  To: keyrings

Maintainer,

Current mainline (5.14), source file:
security/keys/key.c

line 144:

key->serial >>= 1; /* negative numbers are not permitted */

where serial is int32_t.   >> 1 is not converting negative to positive. It is making a smaller negative value. 

Regards,
Mike M.

This e-mail is from Ultra Electronics Defense, Inc. (or a subsidiary of).  This message and any attachment may contain confidential, privileged or otherwise protected information. If you are not the intended recipient, please do not use, copy, forward or disclose the contents of this message or any attachment. Instead, please delete this message and any attachment from your system immediately.  All communications may be subject to interception or monitoring for operational and/or security purposes. Please rely on your own virus checking as the sender cannot accept any liability for any damage arising from any bug or virus infection.

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

* Re: key.c line 144
  2021-09-09 14:51 key.c line 144 Mike Murphy
@ 2021-09-13 21:50 ` Ben Boeckel
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Boeckel @ 2021-09-13 21:50 UTC (permalink / raw)
  To: Mike Murphy; +Cc: keyrings

On Thu, Sep 09, 2021 at 14:51:00 +0000, Mike Murphy wrote:
> Current mainline (5.14), source file:
> security/keys/key.c
> 
> line 144:
> 
> key->serial >>= 1; /* negative numbers are not permitted */
> 
> where serial is int32_t.   >> 1 is not converting negative to
> positive. It is making a smaller negative value. 

Sure, but the loop will go around again if it is `< 3` anyways. I guess
it is really doing useless work in that case and should just be
completely removed.

--Ben

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

end of thread, other threads:[~2021-09-13 21:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09 14:51 key.c line 144 Mike Murphy
2021-09-13 21:50 ` Ben Boeckel

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).