Thread (18 messages) 18 messages, 5 authors, 2024-06-13

Re: [PATCH] uapi/asm/termbits: Use the U integer suffix for bit fields

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2024-06-12 13:35:23
Also in: linux-man

On Wed, Jun 12, 2024 at 03:16:58PM +0200, Alejandro Colomar wrote:
Constants that are to be used in bitwise operations should be unsigned,
or a user could easily trigger Undefined Behavior.
Wait, do we really have such broken compilers out there?  If so, how has
no one hit this before?
Also, the types where these constants are to be assigned are unsigned,
so this makes it more consistent.
Fair enough.
alx@debian:/usr/include$ grepc -tt termios asm-generic/
asm-generic/termbits.h:struct termios {
	tcflag_t c_iflag;		/* input mode flags */
	tcflag_t c_oflag;		/* output mode flags */
	tcflag_t c_cflag;		/* control mode flags */
	tcflag_t c_lflag;		/* local mode flags */
	cc_t c_line;			/* line discipline */
	cc_t c_cc[NCCS];		/* control characters */
};
alx@debian:/usr/include$ grepc -tt tcflag_t asm-generic/
asm-generic/termbits.h:typedef unsigned int	tcflag_t;
alx@debian:/usr/include$ grepc -tt cc_t asm-generic/
asm-generic/termbits-common.h:typedef unsigned char	cc_t;
alx@debian:/usr/include$ grepc -tt speed_t asm-generic/
asm-generic/termbits-common.h:typedef unsigned int	speed_t;

Link: <https://lore.kernel.org/linux-api/2024061222-scuttle-expanse-6438@gregkh/T/ (local)>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Palmer Dabbelt <redacted>
Cc: <redacted>
Cc: <redacted>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---

Hi Greg,

On Wed, Jun 12, 2024 at 02:22:37PM GMT, Greg KH wrote:
quoted
Have a proposed patch that you feel would resolve this?

thanks,

greg k-h
Here it is.  :)

For reviewing it, I suggest using '--word-diff-regex=.'.

I compiled the kernel, and it seems ok; didn't test more than that.
With this change, can the glibc versions then be dropped to just rely on
these instead?

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help