kmallocs with swapped parameters in fs/dlm/lock.c
Hi David,
Sparse spotted a couple of places in fs/dlm/lock.c where the size/flags
parameters to kmalloc got swapped:
The sparse output is:fs/dlm/lock.c:852:42: warning: incorrect type in argument 1 (different base types)fs/dlm/lock.c:852:42: expected unsigned long [unsigned] [usertype] sizefs/dlm/lock.c:852:42: got restricted gfp_tfs/dlm/lock.c:852:64: warning: incorrect type in argument 2 (different base types)fs/dlm/lock.c:852:64: expected restricted gfp_t [usertype] flagsfs/dlm/lock.c:852:64: got unsigned longfs/dlm/lock.c:4136:27: warning: incorrect type in argument 1 (different base types)fs/dlm/lock.c:4136:27: expected unsigned long [unsigned] [usertype] sizefs/dlm/lock.c:4136:27: got restricted gfp_tfs/dlm/lock.c:4136:39: warning: incorrect type in argument 2 (different base types)fs/dlm/lock.c:4136:39: expected restricted gfp_t [usertype] flagsfs/dlm/lock.c:4136:39: got unsigned long
Line 852 is:
warned = kmalloc(GFP_KERNEL, num_nodes * sizeof(int));
Line 4136 is:
ms_stub = kmalloc(GFP_KERNEL, sizeof(struct dlm_message));and at least one of the defs of kmalloc is:
slab_def.h:static __always_inline void *kmalloc(size_t size, gfp_t flags)
Given that I haven't got a clue how to test a dlm, it's probably best that you patch it.
Jesper:
I noticed in your patch:
https://lkml.org/lkml/2011/7/2/90
where you had done a kmalloc->kzalloc transform you kept the swap.
This looks like new code in 3.0rc so I don't think you could quite call it a regression, but it should probably be fixed fairly quickly I guess.
Dave
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ gro.gilbert @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
Quoted 4 lines · Dr. David Alan Gilbert
Hi David,
Sparse spotted a couple of places infs/dlm/lock.cwhere the size/flags
parameters to kmalloc got swapped:
[...]
Quoted 10 lines
Jesper:
I noticed in your patch:
https://lkml.org/lkml/2011/7/2/90where you had done a
kmalloc->kzalloctransform you kept the swap.This looks like new code in 3.0rc so I don't think you could quite call it a regression, but it should probably be fixed fairly quickly I guess.
D'oh, I completely overlooked that.
Thank you for noticing and letting me know. I've just submitted an updated patch.
Signature · 3 lines
Jesper Juhl <[email protected]> http://www.chaosbits.net/ Don't top-post http://www.catb.org/jargon/html/T/top-post.html Plain text mails only, please.
Quoted 11 lines · * Jesper Juhl ([email protected]) wrote:
Quoted 4 lines · Dr. David Alan Gilbert
Hi David,
Sparse spotted a couple of places infs/dlm/lock.cwhere the size/flags
parameters to kmalloc got swapped:[...]
Quoted 4 lines
Jesper:
I noticed in your patch:
https://lkml.org/lkml/2011/7/2/90
Quoted 7 lines
Quoted 6 lines
where you had done a
kmalloc->kzalloctransform you kept the swap.This looks like new code in 3.0rc so I don't think you could quite call it a regression, but it should probably be fixed fairly quickly I guess.
D'oh, I completely overlooked that.
No problem.
Quoted 2 lines
Thank you for noticing and letting me know. I've just submitted an updated patch.
Great - it's probably worth you fixing the 2nd case in the same file in the same patch, rather than just the one that you were changing anyway?
Dave
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ gro.gilbert @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
Quoted 20 lines · Dr. David Alan Gilbert
Quoted 11 lines · * Jesper Juhl ([email protected]) wrote:
Quoted 4 lines · Dr. David Alan Gilbert
Hi David,
Sparse spotted a couple of places infs/dlm/lock.cwhere the size/flags
parameters to kmalloc got swapped:[...]
Quoted 4 lines
Jesper:
I noticed in your patch:
https://lkml.org/lkml/2011/7/2/90Quoted 7 lines
Quoted 6 lines
where you had done a
kmalloc->kzalloctransform you kept the swap.This looks like new code in 3.0rc so I don't think you could quite call it a regression, but it should probably be fixed fairly quickly I guess.
D'oh, I completely overlooked that.
Quoted 9 lines
No problem.
Quoted 2 lines
Thank you for noticing and letting me know. I've just submitted an updated patch.
Great - it's probably worth you fixing the 2nd case in the same file in the same patch, rather than just the one that you were changing anyway?
I guess so. I'll update my patch later this evening when I get home from work.
Signature · 3 lines
Jesper Juhl <[email protected]> http://www.chaosbits.net/ Don't top-post http://www.catb.org/jargon/html/T/top-post.html Plain text mails only, please.
Quoted 27 lines · Jesper Juhl
Quoted 25 lines · Dr. David Alan Gilbert
Quoted 11 lines · * Jesper Juhl ([email protected]) wrote:
Quoted 4 lines · Dr. David Alan Gilbert
Hi David,
Sparse spotted a couple of places infs/dlm/lock.cwhere the size/flags
parameters to kmalloc got swapped:[...]
Quoted 4 lines
Jesper:
I noticed in your patch:
https://lkml.org/lkml/2011/7/2/90Quoted 7 lines
Quoted 6 lines
where you had done a
kmalloc->kzalloctransform you kept the swap.This looks like new code in 3.0rc so I don't think you could quite call it a regression, but it should probably be fixed fairly quickly I guess.
D'oh, I completely overlooked that.
No problem.
Quoted 2 lines
Thank you for noticing and letting me know. I've just submitted an updated patch.
Quoted 6 lines
Quoted 4 lines
Great - it's probably worth you fixing the 2nd case in the same file in the same patch, rather than just the one that you were changing anyway?
I guess so. I'll update my patch later this evening when I get home from work.
I'll wait for your patch(es) before fixing any of these myself. Thanks,
Dave
Quoted 33 lines · Dr. David Alan Gilbert
Hi David,
Sparse spotted a couple of places infs/dlm/lock.cwhere the size/flags
parameters to kmalloc got swapped:The sparse output is:
fs/dlm/lock.c:852:42: warning: incorrect type in argument 1 (different base types)fs/dlm/lock.c:852:42: expected unsigned long [unsigned] [usertype] sizefs/dlm/lock.c:852:42: got restrictedgfp_tfs/dlm/lock.c:852:64: warning: incorrect type in argument 2 (different base types)fs/dlm/lock.c:852:64: expected restrictedgfp_t[usertype] flagsfs/dlm/lock.c:852:64: got unsigned longfs/dlm/lock.c:4136:27: warning: incorrect type in argument 1 (different base types)fs/dlm/lock.c:4136:27: expected unsigned long [unsigned] [usertype] sizefs/dlm/lock.c:4136:27: got restrictedgfp_tfs/dlm/lock.c:4136:39: warning: incorrect type in argument 2 (different base types)fs/dlm/lock.c:4136:39: expected restrictedgfp_t[usertype] flagsfs/dlm/lock.c:4136:39: got unsigned longLine 852 is:
warned = kmalloc(GFP_KERNEL, num_nodes * sizeof(int)); Line 4136 is: ms_stub = kmalloc(GFP_KERNEL, sizeof(struct dlm_message));and at least one of the defs of kmalloc is:
slab_def.h:static__always_inlinevoid *kmalloc(size_t size,gfp_tflags)Given that I haven't got a clue how to test a dlm, it's probably best that you patch it.
Jesper:
I noticed in your patch:
https://lkml.org/lkml/2011/7/2/90
Quoted 5 lines
where you had done a
kmalloc->kzalloctransform you kept the swap.This looks like new code in 3.0rc so I don't think you could quite call it a regression, but it should probably be fixed fairly quickly I guess.
Thanks, I'll get that fixed.
Dave