Skip to contentSkip to conversation

fs: compat: Remove warning from COMPATIBLE_IOCTL

PATCH Superseded Matthias Kaehlcke 2 participants 6 messages Apr 4, 2017 – Apr 20, 2017 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: compat: Remove warning from COMPATIBLE_IOCTL

From: Mark Charlebois <[email protected]>

cmd in COMPATIBLE_IOCTL is always a u32, so cast it so there isn't a warning about an overflow in XFORM.

From: Mark Charlebois <[email protected]>

---
Resending https://patchwork.kernel.org/patch/4961631/

 fs/compat_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/compat_ioctl.c +1 -1
index 11d087b2b28e..6116d5275a3e 100644
@@ -833,7 +833,7 @@ static int compat_ioctl_preallocate(struct file *file,
  */
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff)
 
-#define COMPATIBLE_IOCTL(cmd) XFORM(cmd),
+#define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd),
 /* ioctl should not be warned about even if it's not implemented.
    Valid reasons to use this:
    - It is implemented with ->compat_ioctl on some device, but programs
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#1 lore raw

El Tue, Apr 04, 2017 at 11:07:20AM -0700 Matthias Kaehlcke ha dit:

Quoted 21 lines

From: Mark Charlebois <[email protected]>

cmd in COMPATIBLE_IOCTL is always a u32, so cast it so there isn't a warning about an overflow in XFORM.

From: Mark Charlebois <[email protected]>

---
Resending https://patchwork.kernel.org/patch/4961631/

 fs/compat_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/compat_ioctl.c +0 -0
index 11d087b2b28e..6116d5275a3e 100644

fs/compat_ioctl.c static int compat_ioctl_preallocate(struct file *file, · line 839

Quoted 8 lines
fs/compat_ioctl.c +1 -1
@@ -833,7 +833,7 @@ static int compat_ioctl_preallocate(struct file *file,
  */
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff)
 
-#define COMPATIBLE_IOCTL(cmd) XFORM(cmd),
+#define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd),
 /* ioctl should not be warned about even if it's not implemented.
    Valid reasons to use this:
    - It is implemented with ->compat_ioctl on some device, but programs

Ping, any feedback on this change?

Thanks

Matthias

Acked-by
#2 lore raw
Quoted 14 lines · Matthias Kaehlcke

El Tue, Apr 04, 2017 at 11:07:20AM -0700 Matthias Kaehlcke ha dit:

Quoted 12 lines

From: Mark Charlebois <[email protected]>

cmd in COMPATIBLE_IOCTL is always a u32, so cast it so there isn't a warning about an overflow in XFORM.

From: Mark Charlebois <[email protected]>

---
Resending https://patchwork.kernel.org/patch/4961631/

The patch looks correct to me,

Quoted 11 lines
Quoted 11 lines
 fs/compat_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/compat_ioctl.c +0 -0
index 11d087b2b28e..6116d5275a3e 100644
@@ -833,7 +833,7 @@ static int compat_ioctl_preallocate(struct file *file,
  */
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff)
 
Quoted 7 lines

fs/compat_ioctl.c static int compat_ioctl_preallocate(struct file *file, · line 839

Quoted 5 lines
fs/compat_ioctl.c +1 -1
-#define COMPATIBLE_IOCTL(cmd) XFORM(cmd),
+#define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd),
 /* ioctl should not be warned about even if it's not implemented.
    Valid reasons to use this:
    - It is implemented with ->compat_ioctl on some device, but programs

Ping, any feedback on this change?

One minor comment on the patch: when you address a warning in a patch, it helps to put the compiler warning output into the changelog.

Aside from that, I see that you are upstreaming a number of clang related patches. I actually have a longer series of clang patches that I took from llvmlinux and hacked up to the point where I could build ARM randconfig kernels without any warnings or errors. If you are interested, I can separate the clang patches from my normal randconfig build tree and upload the git tree for you to look at and cherry-pick further patches.

Arnd

#3 lore raw

Hi Arnd,

El Wed, Apr 19, 2017 at 10:48:47PM +0200 Arnd Bergmann ha dit:

Quoted 16 lines · Matthias Kaehlcke
Quoted 14 lines

El Tue, Apr 04, 2017 at 11:07:20AM -0700 Matthias Kaehlcke ha dit:

Quoted 12 lines

From: Mark Charlebois <[email protected]>

cmd in COMPATIBLE_IOCTL is always a u32, so cast it so there isn't a warning about an overflow in XFORM.

From: Mark Charlebois <[email protected]>

---
Resending https://patchwork.kernel.org/patch/4961631/

Quoted 3 lines

The patch looks correct to me,

Thanks for the review!

Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
 fs/compat_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/compat_ioctl.c +0 -0
index 11d087b2b28e..6116d5275a3e 100644
@@ -833,7 +833,7 @@ static int compat_ioctl_preallocate(struct file *file,
  */
 #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff)
 
Quoted 7 lines

fs/compat_ioctl.c static int compat_ioctl_preallocate(struct file *file, · line 839

Quoted 5 lines
fs/compat_ioctl.c +1 -1
-#define COMPATIBLE_IOCTL(cmd) XFORM(cmd),
+#define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd),
 /* ioctl should not be warned about even if it's not implemented.
    Valid reasons to use this:
    - It is implemented with ->compat_ioctl on some device, but programs

Ping, any feedback on this change?

Quoted 2 lines

One minor comment on the patch: when you address a warning in a patch, it helps to put the compiler warning output into the changelog.

Thanks, I added it initially and then wondered if it is too much noise. Will take it into account in the future.

Quoted 7 lines

Aside from that, I see that you are upstreaming a number of clang related patches. I actually have a longer series of clang patches that I took from llvmlinux and hacked up to the point where I could build ARM randconfig kernels without any warnings or errors. If you are interested, I can separate the clang patches from my normal randconfig build tree and upload the git tree for you to look at and cherry-pick further patches.

Sure, that would be interesting, though I won't promise to take up everything :)

Cheers

Matthias

#4 lore raw
Quoted 12 lines · Matthias Kaehlcke

El Wed, Apr 19, 2017 at 10:48:47PM +0200 Arnd Bergmann ha dit:

Quoted 10 lines · Matthias Kaehlcke
Quoted 1 line

El Tue, Apr 04, 2017 at 11:07:20AM -0700 Matthias Kaehlcke ha dit:

Aside from that, I see that you are upstreaming a number of clang related patches. I actually have a longer series of clang patches that I took from llvmlinux and hacked up to the point where I could build ARM randconfig kernels without any warnings or errors. If you are interested, I can separate the clang patches from my normal randconfig build tree and upload the git tree for you to look at and cherry-pick further patches.

Quoted 2 lines

Sure, that would be interesting, though I won't promise to take up everything :)

I see now that almost all the patches I did have been picked up in the meantime, so I'm sure you already have most of the remaining contents as they come from the old llvmlinux project. For reference, I've uploaded my set to

git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
next-20170420+llvmlinux

This is rebased from the middle of a larger series, so there might be problems I introduce. Just have a look to see what you can use.

Arnd

#5 lore raw

El Thu, Apr 20, 2017 at 10:45:47AM +0200 Arnd Bergmann ha dit:

Quoted 13 lines · Matthias Kaehlcke
Quoted 12 lines

El Wed, Apr 19, 2017 at 10:48:47PM +0200 Arnd Bergmann ha dit:

Quoted 10 lines · Matthias Kaehlcke
Quoted 1 line

El Tue, Apr 04, 2017 at 11:07:20AM -0700 Matthias Kaehlcke ha dit:

Aside from that, I see that you are upstreaming a number of clang related patches. I actually have a longer series of clang patches that I took from llvmlinux and hacked up to the point where I could build ARM randconfig kernels without any warnings or errors. If you are interested, I can separate the clang patches from my normal randconfig build tree and upload the git tree for you to look at and cherry-pick further patches.

Quoted 6 lines
Quoted 2 lines

Sure, that would be interesting, though I won't promise to take up everything :)

I see now that almost all the patches I did have been picked up in the meantime, so I'm sure you already have most of the remaining contents as they come from the old llvmlinux project.

Yeah, I picked a subset of the llvmlinux patches from different sources.

Quoted 7 lines

For reference, I've uploaded my set to

git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
next-20170420+llvmlinux

This is rebased from the middle of a larger series, so there might be problems I introduce. Just have a look to see what you can use.

Thanks!

Matthias