Enable -funsigned-char and fix code affected by that flag.
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEq5lC5tSkz8NBJiCnSfxwEqXeA64FAmOOBhcACgkQSfxwEqXe
A65pPBAAnKLnV0/pqCEO655pvWC9mhEXGsVkpsC0SkszXqKGJGEnc2ueC0S7tmB9
j+tPz2ea5hOjE2Os8iSrt5CYzha3dXugdZoCzW5ZXI3XLpUis83sQkkji0gxsMw+
3H28LvfM+NvfNuc0vvWTfQ61S9SXSvIT7cB5UE5vynolpPxD+ofgss3YAEkWWsP8
tXAcT3/BfyRoUc0iLGEULcjhhyLl8uvGhqQgnPE5rSKLyXh5Wu7kc7npzpVqniCN
EGV61pB0sNeCOSJF/1HK13oFf76DKMuCMcckQyBcqOoKHbKidqKccELjpMM2UC3K
ygC3EcLP6lgXDo+Cty8bRIWu14jv1MbhMt9oMDHHoI664DOC8E86iUOFM2jF4PwW
xaDZ7W359O8OqS4n0b/YsopmfHsq/Vb3GVdURYVEfH4sWeOcYD1mGbKSRhb5UkRf
gZJB5nK51kgBbQGAhaPRkmetueSUFOxoexzpivmwiKcb1kMYoBulYLJFLQ80nWAb
yHI2pYfzUUCqLBGNTVgM3MlhIcxUgXyHDQbsIc9mBmk361lG0PAVqocqbt/zbNM2
QPALqfrYeOc2xK3zRF2MMiEGTrgEI0d7KNv1LBrPyqAZezpvYcsSAzrBM8wG7AO8
UGwrgHp2VNw0pDReBUZ4/7lpO7YcqnKuDAtoW8Z9NPrZyAcL/Rg=
=CxjR
-----END PGP SIGNATURE-----
Merge tag 'unsigned-char-6.2-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/linux
Pull unsigned-char conversion from Jason Donenfeld:
"Enable -funsigned-char and fix code affected by that flag.
During the 6.1 cycle, several patches already made it into the tree,
which were for code that was already broken on at least one
architecture, where the naked char had a different sign than the code
author anticipated, or were part of some bug fix for an existing bug
that this initiative unearthed.
These 6.1-era fixes are:
648060902a ("MIPS: pic32: treat port as signed integer")
5c26159c97 ("ipvs: use explicitly signed chars")
e6cb876945 ("wifi: airo: do not assign -1 to unsigned char")
937ec9f7d5 ("staging: rtl8192e: remove bogus ssid character sign test")
6770473832 ("misc: sgi-gru: use explicitly signed char")
50895a55bc ("ALSA: rme9652: use explicitly signed char")
ee03c0f200 ("ALSA: au88x0: use explicitly signed char")
835bed1b83 ("fbdev: sisfb: use explicitly signed char")
50f19697dd ("parisc: Use signed char for hardware path in pdc.h")
66063033f7 ("wifi: rt2x00: use explicitly signed or unsigned types")
Regarding patches in this pull:
- There is one patch in this pull that should have made it to you
during 6.1 ("media: stv0288: use explicitly signed char"), but the
maintainer was MIA during the cycle, so it's in here instead.
- Two patches fix single architecture code affected by unsigned char
("perf/x86: Make struct p4_event_bind::cntr signed array" and
"sparc: sbus: treat CPU index as integer"), while one patch fixes
an unused typedef, in case it's ever used in the future ("media:
atomisp: make hive_int8 explictly signed").
- Finally, there's the change to actually enable -funsigned-char
("kbuild: treat char as always unsigned") and then the removal of
some no longer useful !__CHAR_UNSIGNED__ selftest code ("lib:
assume char is unsigned").
The various fixes were found with a combination of diffing objdump
output, a large variety of Coccinelle scripts, and plain old grep. In
the end, things didn't seem as bad as I feared they would. But of
course, it's also possible I missed things.
However, this has been in linux-next for basically an entire cycle
now, so I'm not overly worried. I've also been daily driving this on
my laptop for all of 6.1. Still, this series, and the ones sent for
6.1 don't total in quantity to what I thought it'd be, so I will be on
the lookout for breakage.
We could receive a few reports that are quickly fixable. Hopefully we
won't receive a barrage of reports that would result in a revert. And
just maybe we won't receive any reports at all and nobody will even
notice. Knock on wood"
* tag 'unsigned-char-6.2-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/linux:
lib: assume char is unsigned
kbuild: treat char as always unsigned
media: atomisp: make hive_int8 explictly signed
media: stv0288: use explicitly signed char
sparc: sbus: treat CPU index as integer
perf/x86: Make struct p4_event_bind::cntr signed array
This commit is contained in:
commit
3a28c2c89f
2
Makefile
2
Makefile
|
|
@ -562,7 +562,7 @@ KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
|
|||
KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
|
||||
-fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
|
||||
-Werror=implicit-function-declaration -Werror=implicit-int \
|
||||
-Werror=return-type -Wno-format-security \
|
||||
-Werror=return-type -Wno-format-security -funsigned-char \
|
||||
-std=gnu11
|
||||
KBUILD_CPPFLAGS := -D__KERNEL__
|
||||
KBUILD_RUSTFLAGS := $(rust_common_flags) \
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ struct p4_event_bind {
|
|||
unsigned int escr_msr[2]; /* ESCR MSR for this event */
|
||||
unsigned int escr_emask; /* valid ESCR EventMask bits */
|
||||
unsigned int shared; /* event is shared across threads */
|
||||
char cntr[2][P4_CNTR_LIMIT]; /* counter index (offset), -1 on absence */
|
||||
signed char cntr[2][P4_CNTR_LIMIT]; /* counter index (offset), -1 on absence */
|
||||
};
|
||||
|
||||
struct p4_pebs_bind {
|
||||
|
|
|
|||
|
|
@ -440,9 +440,8 @@ static int stv0288_set_frontend(struct dvb_frontend *fe)
|
|||
struct stv0288_state *state = fe->demodulator_priv;
|
||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||
|
||||
char tm;
|
||||
unsigned char tda[3];
|
||||
u8 reg, time_out = 0;
|
||||
u8 tda[3], reg, time_out = 0;
|
||||
s8 tm;
|
||||
|
||||
dprintk("%s : FE_SET_FRONTEND\n", __func__);
|
||||
|
||||
|
|
|
|||
|
|
@ -363,8 +363,8 @@ static int envctrl_read_cpu_info(int cpu, struct i2c_child_t *pchild,
|
|||
char mon_type, unsigned char *bufdata)
|
||||
{
|
||||
unsigned char data;
|
||||
int i;
|
||||
char *tbl, j = -1;
|
||||
int i, j = -1;
|
||||
char *tbl;
|
||||
|
||||
/* Find the right monitor type and channel. */
|
||||
for (i = 0; i < PCF8584_MAX_CHANNELS; i++) {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ typedef unsigned int hive_bool;
|
|||
#define hive_false 0
|
||||
#define hive_true 1
|
||||
|
||||
typedef char hive_int8;
|
||||
typedef signed char hive_int8;
|
||||
typedef short hive_int16;
|
||||
typedef int hive_int32;
|
||||
typedef long long hive_int64;
|
||||
|
|
|
|||
|
|
@ -21,11 +21,7 @@ static void is_signed_type_test(struct kunit *test)
|
|||
KUNIT_EXPECT_EQ(test, is_signed_type(bool), false);
|
||||
KUNIT_EXPECT_EQ(test, is_signed_type(signed char), true);
|
||||
KUNIT_EXPECT_EQ(test, is_signed_type(unsigned char), false);
|
||||
#ifdef __CHAR_UNSIGNED__
|
||||
KUNIT_EXPECT_EQ(test, is_signed_type(char), false);
|
||||
#else
|
||||
KUNIT_EXPECT_EQ(test, is_signed_type(char), true);
|
||||
#endif
|
||||
KUNIT_EXPECT_EQ(test, is_signed_type(int), true);
|
||||
KUNIT_EXPECT_EQ(test, is_signed_type(unsigned int), false);
|
||||
KUNIT_EXPECT_EQ(test, is_signed_type(long), true);
|
||||
|
|
|
|||
|
|
@ -179,18 +179,6 @@ test_number(void)
|
|||
* behaviour.
|
||||
*/
|
||||
test("00|0|0|0|0", "%.2d|%.1d|%.0d|%.*d|%1.0d", 0, 0, 0, 0, 0, 0);
|
||||
#ifndef __CHAR_UNSIGNED__
|
||||
{
|
||||
/*
|
||||
* Passing a 'char' to a %02x specifier doesn't do
|
||||
* what was presumably the intention when char is
|
||||
* signed and the value is negative. One must either &
|
||||
* with 0xff or cast to u8.
|
||||
*/
|
||||
char val = -16;
|
||||
test("0xfffffff0|0xf0|0xf0", "%#02x|%#02x|%#02x", val, val & 0xff, (u8)val);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __init
|
||||
|
|
|
|||
Loading…
Reference in New Issue