Skip to contentSkip to conversation

s390/time: Fix clk type in get_tod_clock

PATCH In review Nathan Chancellor 3 participants 6 messages Feb 8, 2020 – Feb 11, 2020 s390

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/time: Fix clk type in get_tod_clock

Clang warns:

In file included from ../arch/s390/boot/startup.c:3:
In file included from ../include/linux/elf.h:5:
In file included from ../arch/s390/include/asm/elf.h:132:
In file included from ../include/linux/compat.h:10:
In file included from ../include/linux/time.h:74:
In file included from ../include/linux/time32.h:13:
In file included from ../include/linux/timex.h:65:
../arch/s390/include/asm/timex.h:160:20: warning: passing 'unsigned char [16]' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]

        get_tod_clock_ext(clk);
                          ^~~
../arch/s390/include/asm/timex.h:149:44: note: passing argument to
parameter 'clk' here
static inline void get_tod_clock_ext(char *clk)
                                           ^

Change clk's type to just be char so that it matches what happens in get_tod_clock_ext.

Fixes 57b28f66316d ("[S390] s390_hypfs: Add new attributes")

---

Alternatively, changing the clk type in get_tod_clock_ext to unsigned which is what it was in the early 2000s.

 arch/s390/include/asm/timex.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/timex.h +1 -1
index 670f14a228e5..6bf3a45ccfec 100644
@@ -155,7 +155,7 @@ static inline void get_tod_clock_ext(char *clk)
 
 static inline unsigned long long get_tod_clock(void)
 {
-	unsigned char clk[STORE_CLOCK_EXT_SIZE];
+	char clk[STORE_CLOCK_EXT_SIZE];
 
 	get_tod_clock_ext(clk);
 	return *((unsigned long long *)&clk[1]);
Signature · 1 line
2.25.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Nathan Chancellor

Clang warns:

In file included from ../arch/s390/boot/startup.c:3:
In file included from ../include/linux/elf.h:5:
In file included from ../arch/s390/include/asm/elf.h:132:
In file included from ../include/linux/compat.h:10:
In file included from ../include/linux/time.h:74:
In file included from ../include/linux/time32.h:13:
In file included from ../include/linux/timex.h:65:
../arch/s390/include/asm/timex.h:160:20: warning: passing 'unsigned char [16]' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]

        get_tod_clock_ext(clk);
                          ^~~
../arch/s390/include/asm/timex.h:149:44: note: passing argument to
parameter 'clk' here
static inline void get_tod_clock_ext(char *clk)
                                           ^
Quoted 6 lines

Change clk's type to just be char so that it matches what happens in get_tod_clock_ext.

Fixes 57b28f66316d ("[S390] s390_hypfs: Add new attributes")

First time I've seen a typedef in a function. I wonder if that makes its definition have function scope? (re: get_tod_clock_ext())

Quoted 4 lines

---

Alternatively, changing the clk type in get_tod_clock_ext to unsigned which is what it was in the early 2000s.

Yeah, it doesn't really matter for this case, it looks like. Either way,

Quoted 24 lines
 arch/s390/include/asm/timex.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/timex.h +1 -2
index 670f14a228e5..6bf3a45ccfec 100644
@@ -155,7 +155,7 @@ static inline void get_tod_clock_ext(char *clk)
 
 static inline unsigned long long get_tod_clock(void)
 {
-       unsigned char clk[STORE_CLOCK_EXT_SIZE];
+       char clk[STORE_CLOCK_EXT_SIZE];
 
        get_tod_clock_ext(clk);
        return *((unsigned long long *)&clk[1]);
--

2.25.0

--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200208140858.47970-1-natechancellor%40gmail.com.

Signature · 2 lines
Thanks,
~Nick Desaulniers
maintainer
#2 lore raw
In reply to Nathan Chancellor
Quoted 49 lines · Nathan Chancellor

Clang warns:

In file included from ../arch/s390/boot/startup.c:3:
In file included from ../include/linux/elf.h:5:
In file included from ../arch/s390/include/asm/elf.h:132:
In file included from ../include/linux/compat.h:10:
In file included from ../include/linux/time.h:74:
In file included from ../include/linux/time32.h:13:
In file included from ../include/linux/timex.h:65:
../arch/s390/include/asm/timex.h:160:20: warning: passing 'unsigned char [16]' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]

        get_tod_clock_ext(clk);
                          ^~~
../arch/s390/include/asm/timex.h:149:44: note: passing argument to
parameter 'clk' here
static inline void get_tod_clock_ext(char *clk)
                                           ^

Change clk's type to just be char so that it matches what happens in get_tod_clock_ext.

Fixes 57b28f66316d ("[S390] s390_hypfs: Add new attributes")

---

Alternatively, changing the clk type in get_tod_clock_ext to unsigned which is what it was in the early 2000s.

 arch/s390/include/asm/timex.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/timex.h +1 -1
index 670f14a228e5..6bf3a45ccfec 100644
@@ -155,7 +155,7 @@ static inline void get_tod_clock_ext(char *clk)
 
 static inline unsigned long long get_tod_clock(void)
 {
-	unsigned char clk[STORE_CLOCK_EXT_SIZE];
+	char clk[STORE_CLOCK_EXT_SIZE];
 
 	get_tod_clock_ext(clk);
 	return *((unsigned long long *)&clk[1]);
Signature · 1 line
2.25.0

Applied, thanks.
I wonder though if Fixes: tag is really required for such changes. It triggers stable backports (for all stable branches since v2.6.35) and hence a lot of noise.

#5 lore raw
Quoted 5 lines · Vasily Gorbik
Quoted 3 lines · Nick Desaulniers
Quoted 1 line · Vasily Gorbik

Applied, thanks.

Quoted 8 lines
Quoted 4 lines

Hi Vasily, is this the expected tree+branch that the patch will be pushed to? (I'm trying to track when+where our patches land).
https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git/log/?h=fixes

Hi Nick,
yes, this is correct. There might be some delay due to ci runs. But this particular patch is now landed on that fixes branch.

Ah, yeah now I see it, thanks. The aggressive patch tracking helps us figure out what landed where so that we can better backport patches to LTS (hence the Fixes tags you've seen on other patches).

Signature · 2 lines
Thanks,
~Nick Desaulniers