staging: nvec: Remove unnecessary cast on void pointer
PATCH 1/5 staging: nvec: Remove unnecessary cast on void pointer
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)
--- drivers/staging/nvec/nvec_kbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/nvec/nvec_kbd.c +1 -1
@@ -58,7 +58,7 @@ static int nvec_keys_notifier(struct notifier_block *nb, unsigned long event_type, void *data) { int code, state; -unsigned char *msg = (unsigned char *)data; +unsigned char *msg = data;if (event_type ==NVEC_KB_EVT ) {int _size = (msg[0 ] & (3 <<5 )) >>5 ;
Signature · 1 line
2.7.4
PATCH 2/5 staging: lustre: Remove unnecessary cast on void pointer
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)
--- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +2 -2
@@ -640,7 +640,7 @@ static int lmv_fid2path(struct obd_export *exp, int len, void *karg,int remote_gf_size =0 ;int rc; - gf = (struct getinfo_fid2path *)karg; + gf = karg; tgt =lmv_find_target (lmv, &gf->gf_fid);if (IS_ERR (tgt))return PTR_ERR (tgt);
@@ -657,7 +657,7 @@ static int lmv_fid2path(struct obd_export *exp, int len, void *karg,struct getinfo_fid2path *ori_gf;char *ptr; - ori_gf = (struct getinfo_fid2path *)karg; + ori_gf = karg;if (strlen (ori_gf->gf_path) +strlen (gf->gf_path) > ori_gf->gf_pathlen) { rc = -EOVERFLOW ;
Signature · 1 line
2.7.4
PATCH 3/5 staging: lustre: lustre: Remove unnecessary cast on void pointer
In reply to simran singhalThe following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)
--- drivers/staging/lustre/lustre/llite/range_lock.c | 2 +- drivers/staging/lustre/lustre/mgc/mgc_request.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/llite/range_lock.c +1 -1
@@ -174,7 +174,7 @@ void range_unlock(struct range_lock_tree *tree, struct range_lock *lock)*/ static enum interval_iter range_lock_cb (struct interval_node *node,void *arg) { -struct range_lock *lock = (struct range_lock *)arg; +struct range_lock *lock = arg;struct range_lock *overlap =node2rangelock (node); lock->rl_blocking_ranges += overlap->rl_lock_count +1 ;
drivers/staging/lustre/lustre/mgc/mgc_request.c +2 -2
@@ -1034,7 +1034,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, rc =sptlrpc_parse_flavor (val, &flvr);if (rc) {CERROR ("invalid sptlrpc flavor %s to MGS\n" , - (char *)val); + val);return rc; }
@@ -1050,7 +1050,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp,sptlrpc_flavor2name (&cli->cl_flvr_mgc, str,sizeof (str));LCONSOLE_ERROR ("asking sptlrpc flavor %s to MGS but currently %s is in use\n" , - (char *)val, str); + val, str); rc = -EPERM ; }return rc;
Signature · 1 line
2.7.4
Joe Perches
NAKRe: [PATCH 3/5] staging: lustre: lustre: Remove unnecessary cast on void pointer
Quoted 14 lines · simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)Quoted 1 line
((T *)x)[...]
Quoted 1 line
Quoted 6 lines
((T*)x)->f
Quoted 1 line
- (T*)
e
)
NAK.
Nice, but you still have to verify correctness
before submitting these patches.
drivers/staging/lustre/lustre/mgc/mgc_request.c
Quoted 1 line
drivers/staging/lustre/lustre/mgc/mgc_request.c +0
-0
[]
drivers/staging/lustre/lustre/mgc/mgc_request.c static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, · line 1037
Quoted 6 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +1
-1@@ -1034,7 +1034,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, rc =sptlrpc_parse_flavor (val, &flvr);if (rc) {CERROR ("invalid sptlrpc flavor %s to MGS\n" , - (char *)val); + val);
Try compiling this.
Re: [PATCH 3/5] staging: lustre: lustre: Remove unnecessary cast on void pointer
Quoted 29 lines · Joe Perches
Quoted 14 lines · simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)Quoted 1 line
((T *)x)[...]
Quoted 1 line
Quoted 6 lines
((T*)x)->f
Quoted 1 line
- (T*)
e
)NAK.
Nice, but you still have to verify correctness
before submitting these patches.drivers/staging/lustre/lustre/mgc/mgc_request.c
Quoted 1 line
drivers/staging/lustre/lustre/mgc/mgc_request.c +0
-0[]
Quoted 9 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, · line 1037
Quoted 6 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +1
-1@@ -1034,7 +1034,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, rc =sptlrpc_parse_flavor (val, &flvr);if (rc) {CERROR ("invalid sptlrpc flavor %s to MGS\n" , - (char *)val); + val);Try compiling this.
I compiled it before sending.
Re: [PATCH 3/5] staging: lustre: lustre: Remove unnecessary cast on void pointer
Quoted 41 lines · SIMRAN SINGHAL
Quoted 30 lines · Joe Perches
Quoted 14 lines · simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)Quoted 1 line
((T *)x)[...]
Quoted 1 line
Quoted 6 lines
((T*)x)->f
Quoted 1 line
- (T*)
e
)NAK.
Nice, but you still have to verify correctness
before submitting these patches.drivers/staging/lustre/lustre/mgc/mgc_request.c
Quoted 1 line
drivers/staging/lustre/lustre/mgc/mgc_request.c +0
-0[]
Quoted 9 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, · line 1037
Quoted 6 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +1
-1@@ -1034,7 +1034,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, rc =sptlrpc_parse_flavor (val, &flvr);if (rc) {CERROR ("invalid sptlrpc flavor %s to MGS\n" , - (char *)val); + val);Try compiling this.
Quoted 1 line
I compiled it before sending.
Did you look at the warnings?
CC [M] drivers/staging/lustre/lustre/mgc/mgc_request.odrivers/staging/lustre/lustre/mgc/mgc_request.c: In function ‘mgc_set_info_async’:drivers/staging/lustre/lustre/mgc/mgc_request.c:1036:115: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘void *’ [-Wformat=] CERROR("invalid sptlrpc flavor %s to MGS\n",
Re: [PATCH 3/5] staging: lustre: lustre: Remove unnecessary cast on void pointer
Quoted 42 lines · Joe Perches
Quoted 41 lines · SIMRAN SINGHAL
Quoted 39 lines · Joe Perches
Quoted 14 lines · simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)Quoted 1 line
((T *)x)[...]
Quoted 1 line
Quoted 6 lines
((T*)x)->f
Quoted 1 line
- (T*)
e
)NAK.
Nice, but you still have to verify correctness
before submitting these patches.drivers/staging/lustre/lustre/mgc/mgc_request.c
Quoted 1 line
drivers/staging/lustre/lustre/mgc/mgc_request.c +0
-0[]
drivers/staging/lustre/lustre/mgc/mgc_request.c static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, · line 1037
Quoted 6 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +1
-1@@ -1034,7 +1034,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, rc =sptlrpc_parse_flavor (val, &flvr);if (rc) {CERROR ("invalid sptlrpc flavor %s to MGS\n" , - (char *)val); + val);Try compiling this.
Quoted 9 lines
Quoted 1 line
I compiled it before sending.
Did you look at the warnings?
CC [M]
drivers/staging/lustre/lustre/mgc/mgc_request.odrivers/staging/lustre/lustre/mgc/mgc_request.c: In function ‘mgc_set_info_async’:drivers/staging/lustre/lustre/mgc/mgc_request.c:1036:115: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘void *’ [-Wformat=]
CERROR("invalid sptlrpc flavor %s to MGS\n",
I again compiled it and this is what I got :-
CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CHK include/generated/timeconst.h CHK include/generated/bounds.h CHK include/generated/asm-offsets.h CALL scripts/checksyscalls.sh CHK include/generated/compile.h LD arch/x86/boot/compressed/vmlinux
ZOFFSET arch/x86/boot/zoffset.h
AS arch/x86/boot/header.o
LD arch/x86/boot/setup.elf
OBJCOPY arch/x86/boot/setup.bin
OBJCOPY arch/x86/boot/vmlinux.bin
BUILD arch/x86/boot/bzImage
Setup is 17500 bytes (padded to 17920 bytes).
System is 7128 kB
CRC 37713343
Kernel: arch/x86/boot/bzImage is ready (#4)
Building modules, stage 2.
MODPOST 4541 modules
I am not getting any warning.
Re: [Outreachy kernel] Re: [PATCH 3/5] staging: lustre: lustre: Remove unnecessary cast on void pointer
Quoted 77 lines · SIMRAN SINGHAL
Quoted 42 lines · Joe Perches
Quoted 41 lines · SIMRAN SINGHAL
Quoted 39 lines · Joe Perches
Quoted 14 lines · simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)Quoted 1 line
((T *)x)[...]
Quoted 1 line
Quoted 6 lines
((T*)x)->f
Quoted 1 line
- (T*)
e
)NAK.
Nice, but you still have to verify correctness
before submitting these patches.drivers/staging/lustre/lustre/mgc/mgc_request.c
Quoted 1 line
drivers/staging/lustre/lustre/mgc/mgc_request.c +0
-0[]
drivers/staging/lustre/lustre/mgc/mgc_request.c static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, · line 1037
Quoted 6 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +1
-1@@ -1034,7 +1034,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, rc =sptlrpc_parse_flavor (val, &flvr);if (rc) {CERROR ("invalid sptlrpc flavor %s to MGS\n" , - (char *)val); + val);Try compiling this.
Quoted 9 lines
Quoted 1 line
I compiled it before sending.
Did you look at the warnings?
CC [M]
drivers/staging/lustre/lustre/mgc/mgc_request.odrivers/staging/lustre/lustre/mgc/mgc_request.c: In function ‘mgc_set_info_async’:drivers/staging/lustre/lustre/mgc/mgc_request.c:1036:115: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘void *’ [-Wformat=]
CERROR("invalid sptlrpc flavor %s to MGS\n",I again compiled it and this is what I got :-
CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CHK include/generated/timeconst.h CHK include/generated/bounds.h CHK include/generated/asm-offsets.h CALL scripts/checksyscalls.sh CHK include/generated/compile.h LD arch/x86/boot/compressed/vmlinuxZOFFSET
arch/x86/boot/zoffset.h
ASarch/x86/boot/header.o
LDarch/x86/boot/setup.elf
OBJCOPYarch/x86/boot/setup.bin
OBJCOPYarch/x86/boot/vmlinux.bin
BUILDarch/x86/boot/bzImage
Setup is 17500 bytes (padded to 17920 bytes).
System is 7128 kB
CRC 37713343
Kernel:arch/x86/boot/bzImageis ready (#4)
Building modules, stage 2.
MODPOST 4541 modules
Quoted 1 line
I am not getting any warning.
Did you touch the .c file before compiling it? Warnings still allow the creation of a .o, and once there is a .o that s more recent than the .c, make won't compile it again.
I got a whole of host of warnings, including the ones Joe showed.
julia
Quoted 8 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CALrZqyP6S2mwYUBERerLnG99qVSFm5jHppjy695JARHMfZ-5Pw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [PATCH 3/5] staging: lustre: lustre: Remove unnecessary cast on void pointer
In reply to SIMRAN SINGHALQuoted 77 lines · SIMRAN SINGHAL
Quoted 42 lines · Joe Perches
Quoted 41 lines · SIMRAN SINGHAL
Quoted 39 lines · Joe Perches
Quoted 14 lines · simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)Quoted 1 line
((T *)x)[...]
Quoted 1 line
Quoted 6 lines
((T*)x)->f
Quoted 1 line
- (T*)
e
)NAK.
Nice, but you still have to verify correctness
before submitting these patches.drivers/staging/lustre/lustre/mgc/mgc_request.c
Quoted 1 line
drivers/staging/lustre/lustre/mgc/mgc_request.c +0
-0[]
drivers/staging/lustre/lustre/mgc/mgc_request.c static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, · line 1037
Quoted 6 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +1
-1@@ -1034,7 +1034,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, rc =sptlrpc_parse_flavor (val, &flvr);if (rc) {CERROR ("invalid sptlrpc flavor %s to MGS\n" , - (char *)val); + val);Try compiling this.
Quoted 9 lines
Quoted 1 line
I compiled it before sending.
Did you look at the warnings?
CC [M]
drivers/staging/lustre/lustre/mgc/mgc_request.odrivers/staging/lustre/lustre/mgc/mgc_request.c: In function ‘mgc_set_info_async’:drivers/staging/lustre/lustre/mgc/mgc_request.c:1036:115: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘void *’ [-Wformat=]
CERROR("invalid sptlrpc flavor %s to MGS\n",I again compiled it and this is what I got :-
CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CHK include/generated/timeconst.h CHK include/generated/bounds.h CHK include/generated/asm-offsets.h CALL scripts/checksyscalls.sh CHK include/generated/compile.h LD arch/x86/boot/compressed/vmlinuxZOFFSET
arch/x86/boot/zoffset.h
ASarch/x86/boot/header.o
LDarch/x86/boot/setup.elf
OBJCOPYarch/x86/boot/setup.bin
OBJCOPYarch/x86/boot/vmlinux.bin
BUILDarch/x86/boot/bzImage
Setup is 17500 bytes (padded to 17920 bytes).
System is 7128 kB
CRC 37713343
Kernel:arch/x86/boot/bzImageis ready (#4)
Building modules, stage 2.
MODPOST 4541 modules
Quoted 1 line
I am not getting any warning.
Then you are likely not compiling the modified file.
try:
$ <git checkout latest-next> $ make clean $ make allyesconfig <apply your patch> $ make drivers/staging/lustre/lustre/mgc/mgc_request.o
kbuild test robot
build botRe: [PATCH 3/5] staging: lustre: lustre: Remove unnecessary cast on void pointer
In reply to simran singhalurl: https://github.com/0day-ci/linux/commits/simran-singhal/staging-nvec-Remove-unnecessary-cast-on-void-pointer/20170304-061120 config: x86_64-randconfig-x018-201709 (attached as .config)…
Hi simran,
[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.10 next-20170303]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/simran-singhal/staging-nvec-Remove-unnecessary-cast-on-void-pointer/20170304-061120
config: x86_64-randconfig-x018-201709 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 All warnings (new ones prefixed by >>):
In file included from drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs.h:77:0,
from drivers/staging/lustre/lustre/mgc/../include/lprocfs_status.h:46, from drivers/staging/lustre/lustre/mgc/mgc_request.c:42:
drivers/staging/lustre/lustre/mgc/mgc_request.c: In function 'mgc_set_info_async':
>> drivers/staging/lustre/lustre/mgc/mgc_request.c:1036:11: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'void *' [-Wformat=]
CERROR("invalid sptlrpc flavor %s to MGS\n",
^
drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:222:30: note: in definition of macro '__CDEBUG'
libcfs_debug_msg(&msgdata, format, ## __VA_ARGS__); \
^~~~~~
>> drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:236:29: note: in expansion of macro 'CDEBUG_LIMIT'
#define CERROR(format, ...) CDEBUG_LIMIT(D_ERROR, format, ## __VA_ARGS__)
^~~~~~~~~~~~
>> drivers/staging/lustre/lustre/mgc/mgc_request.c:1036:4: note: in expansion of macro 'CERROR'
CERROR("invalid sptlrpc flavor %s to MGS\n",
^~~~~~
>> drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:244:7: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'void *' [-Wformat=]
"%x-%x: " format, errnum, LERRCHKSUM(errnum), ## __VA_ARGS__)
^
drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:222:30: note: in definition of macro '__CDEBUG'
libcfs_debug_msg(&msgdata, format, ## __VA_ARGS__); \
^~~~~~
drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:243:49: note: in expansion of macro 'CDEBUG_LIMIT'
#define LCONSOLE_ERROR_MSG(errnum, format, ...) CDEBUG_LIMIT(D_CONSOLE | D_ERROR, \
^~~~~~~~~~~~
>> drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:245:37: note: in expansion of macro 'LCONSOLE_ERROR_MSG'
#define LCONSOLE_ERROR(format, ...) LCONSOLE_ERROR_MSG(0x00, format, ## __VA_ARGS__)
^~~~~~~~~~~~~~~~~~
>> drivers/staging/lustre/lustre/mgc/mgc_request.c:1052:4: note: in expansion of macro 'LCONSOLE_ERROR'LCONSOLE_ERROR("asking sptlrpc flavor %s to MGS but currently %s is in use\n", ^~~~~~~~~~~~~~
vim +1036 drivers/staging/lustre/lustre/mgc/mgc_request.c
d7e09d039 Peng Tao 2013-05-02 1030 val = "null";
d7e09d039 Peng Tao 2013-05-02 1031 vallen = 4;
d7e09d039 Peng Tao 2013-05-02 1032 }
d7e09d039 Peng Tao 2013-05-02 1033
d7e09d039 Peng Tao 2013-05-02 1034 rc = sptlrpc_parse_flavor(val, &flvr);
d7e09d039 Peng Tao 2013-05-02 1035 if (rc) {
d7e09d039 Peng Tao 2013-05-02 @1036 CERROR("invalid sptlrpc flavor %s to MGS\n",
49b8751ff simran singhal 2017-03-03 1037 val);
0a3bdb007 Greg Kroah-Hartman 2013-08-03 1038 return rc;
d7e09d039 Peng Tao 2013-05-02 1039 }
d7e09d039 Peng Tao 2013-05-02 1040
d7e09d039 Peng Tao 2013-05-02 1041 /*
d7e09d039 Peng Tao 2013-05-02 1042 * caller already hold a mutex
d7e09d039 Peng Tao 2013-05-02 1043 */
d7e09d039 Peng Tao 2013-05-02 1044 if (cli->cl_flvr_mgc.sf_rpc == SPTLRPC_FLVR_INVALID) {
d7e09d039 Peng Tao 2013-05-02 1045 cli->cl_flvr_mgc = flvr;
d7e09d039 Peng Tao 2013-05-02 1046 } else if (memcmp(&cli->cl_flvr_mgc, &flvr,
d7e09d039 Peng Tao 2013-05-02 1047 sizeof(flvr)) != 0) {
d7e09d039 Peng Tao 2013-05-02 1048 char str[20];
d7e09d039 Peng Tao 2013-05-02 1049
d7e09d039 Peng Tao 2013-05-02 1050 sptlrpc_flavor2name(&cli->cl_flvr_mgc,
d7e09d039 Peng Tao 2013-05-02 1051 str, sizeof(str));
2d00bd17a Joe Perches 2014-11-23 @1052 LCONSOLE_ERROR("asking sptlrpc flavor %s to MGS but currently %s is in use\n",
49b8751ff simran singhal 2017-03-03 1053 val, str);
d7e09d039 Peng Tao 2013-05-02 1054 rc = -EPERM;
d7e09d039 Peng Tao 2013-05-02 1055 }:::::: The code at line 1036 was first introduced by commit
:::::: d7e09d0397e84eefbabfd9cb353221f3c6448d83 staging: add Lustre file system client support
:::::: TO: Peng Tao <[email protected]>
:::::: CC: Greg Kroah-Hartman <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH 3/5] staging: lustre: lustre: Remove unnecessary cast on void pointer
In reply to simran singhalurl: https://github.com/0day-ci/linux/commits/simran-singhal/staging-nvec-Remove-unnecessary-cast-on-void-pointer/20170304-061120 config: m68k-allmodconfig (attached as .config) compiler…
Hi simran,
[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.10 next-20170303]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/simran-singhal/staging-nvec-Remove-unnecessary-cast-on-void-pointer/20170304-061120
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 4.9.0
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k
All warnings (new ones prefixed by >>):
In file included from drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs.h:77:0,
from drivers/staging/lustre/lustre/mgc/../include/lprocfs_status.h:46,
from drivers/staging/lustre/lustre/mgc/mgc_request.c:42:
drivers/staging/lustre/lustre/mgc/mgc_request.c: In function 'mgc_set_info_async':
drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:216:16: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'void *' [-Wformat=]
static struct libcfs_debug_msg_data msgdata; \
^
>> drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:232:2: note: in expansion of macro '__CDEBUG'
__CDEBUG(&cdls, mask, format, ## __VA_ARGS__); \
^
drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:236:29: note: in expansion of macro 'CDEBUG_LIMIT'
#define CERROR(format, ...) CDEBUG_LIMIT(D_ERROR, format, ## __VA_ARGS__)
^
drivers/staging/lustre/lustre/mgc/mgc_request.c:1036:4: note: in expansion of macro 'CERROR'
CERROR("invalid sptlrpc flavor %s to MGS\n",
^
drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:216:16: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'void *' [-Wformat=]
static struct libcfs_debug_msg_data msgdata; \
^
>> drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:232:2: note: in expansion of macro '__CDEBUG'
__CDEBUG(&cdls, mask, format, ## __VA_ARGS__); \
^
drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:243:49: note: in expansion of macro 'CDEBUG_LIMIT'
#define LCONSOLE_ERROR_MSG(errnum, format, ...) CDEBUG_LIMIT(D_CONSOLE | D_ERROR, \
^
drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h:245:37: note: in expansion of macro 'LCONSOLE_ERROR_MSG'
#define LCONSOLE_ERROR(format, ...) LCONSOLE_ERROR_MSG(0x00, format, ## __VA_ARGS__)
^ drivers/staging/lustre/lustre/mgc/mgc_request.c:1052:4: note: in expansion of macro 'LCONSOLE_ERROR'
LCONSOLE_ERROR("asking sptlrpc flavor %s to MGS but currently %s is in use\n", ^
vim +/__CDEBUG +232 drivers/staging/lustre/lustre/mgc/../include/../../include/linux/libcfs/libcfs_debug.h
d7e09d039 Peng Tao 2013-05-02 210 return mask & D_CANTMASK ||
d7e09d039 Peng Tao 2013-05-02 211 ((libcfs_debug & mask) && (libcfs_subsystem_debug & subsystem));
d7e09d039 Peng Tao 2013-05-02 212 }
d7e09d039 Peng Tao 2013-05-02 213
d7e09d039 Peng Tao 2013-05-02 214 #define __CDEBUG(cdls, mask, format, ...) \
d7e09d039 Peng Tao 2013-05-02 215 do { \
d7e09d039 Peng Tao 2013-05-02 @216 static struct libcfs_debug_msg_data msgdata; \
d7e09d039 Peng Tao 2013-05-02 217 \
d7e09d039 Peng Tao 2013-05-02 218 CFS_CHECK_STACK(&msgdata, mask, cdls); \
d7e09d039 Peng Tao 2013-05-02 219 \
d7e09d039 Peng Tao 2013-05-02 220 if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \
d7e09d039 Peng Tao 2013-05-02 221 LIBCFS_DEBUG_MSG_DATA_INIT(&msgdata, mask, cdls); \
d7e09d039 Peng Tao 2013-05-02 222 libcfs_debug_msg(&msgdata, format, ## __VA_ARGS__); \
d7e09d039 Peng Tao 2013-05-02 223 } \
d7e09d039 Peng Tao 2013-05-02 224 } while (0)
d7e09d039 Peng Tao 2013-05-02 225
d7e09d039 Peng Tao 2013-05-02 226 #define CDEBUG(mask, format, ...) __CDEBUG(NULL, mask, format, ## __VA_ARGS__)
d7e09d039 Peng Tao 2013-05-02 227
d7e09d039 Peng Tao 2013-05-02 228 #define CDEBUG_LIMIT(mask, format, ...) \
d7e09d039 Peng Tao 2013-05-02 229 do { \
a3ea59e0e Lisa Nguyen 2013-10-21 230 static struct cfs_debug_limit_state cdls; \
d7e09d039 Peng Tao 2013-05-02 231 \
d7e09d039 Peng Tao 2013-05-02 @232 __CDEBUG(&cdls, mask, format, ## __VA_ARGS__); \
d7e09d039 Peng Tao 2013-05-02 233 } while (0)
d7e09d039 Peng Tao 2013-05-02 234
d7e09d039 Peng Tao 2013-05-02 235 #define CWARN(format, ...) CDEBUG_LIMIT(D_WARNING, format, ## __VA_ARGS__):::::: The code at line 232 was first introduced by commit
:::::: d7e09d0397e84eefbabfd9cb353221f3c6448d83 staging: add Lustre file system client support
:::::: TO: Peng Tao <[email protected]>
:::::: CC: Greg Kroah-Hartman <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH 4/5 staging: rts5208: Remove unnecessary cast on void pointer
In reply to simran singhalThe following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)
--- drivers/staging/rts5208/rtsx_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rts5208/rtsx_transport.c +1 -1
@@ -767,7 +767,7 @@ int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len,if (use_sg) { err =rtsx_transfer_sglist_adma (chip, card, - (struct scatterlist *)buf, + buf, use_sg, dma_dir, timeout); }else { err =rtsx_transfer_buf (chip, card, buf, len, dma_dir, timeout);
Signature · 1 line
2.7.4
Re: [Outreachy kernel] [PATCH 4/5] staging: rts5208: Remove unnecessary cast on void pointer
drivers/staging/rts5208/rtsx_transport.c int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len, · line 770
Quoted 10 lines
drivers/staging/rts5208/rtsx_transport.c +1
-1@@ -767,7 +767,7 @@ int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len,if (use_sg) { err = rtsx_transfer_sglist_adma(chip, card, - (struct scatterlist *)buf, + buf,
Here too, buf doesn't need its own line.
julia
Quoted 13 lines
drivers/staging/rts5208/rtsx_transport.c +0
-1use_sg, dma_dir, timeout); }else { err =rtsx_transfer_buf (chip, card, buf, len, dma_dir, timeout); --2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488489544-25941-4-git-send-email-singhalsimran0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 4/5] staging: rts5208: Remove unnecessary cast on void pointer
Quoted 6 lines · Julia Lawall
Quoted 6 lines
drivers/staging/rts5208/rtsx_transport.c +0
-0@@ -767,7 +767,7 @@ int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len,
Quoted 7 lines
drivers/staging/rts5208/rtsx_transport.c int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len, · line 770
Quoted 4 lines
drivers/staging/rts5208/rtsx_transport.c +1
-1if (use_sg) { err = rtsx_transfer_sglist_adma(chip, card, - (struct scatterlist *)buf, + buf,Here too, buf doesn't need its own line.
I will send v2.
Quoted 15 lines
julia
Quoted 13 lines
drivers/staging/rts5208/rtsx_transport.c +0
-1use_sg, dma_dir, timeout); }else { err =rtsx_transfer_buf (chip, card, buf, len, dma_dir, timeout); --2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488489544-25941-4-git-send-email-singhalsimran0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
PATCH 5/5 staging: rtl8712: Remove unnecessary cast on void pointer
In reply to simran singhalThe following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)
--- drivers/staging/rtl8712/rtl8712_recv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/rtl8712_recv.c +5 -5
@@ -444,9 +444,9 @@ void r8712_rxcmd_event_hdl(struct _adapter *padapter, void *prxcmdbuf)u16 cmd_len, drvinfo_sz;struct recv_stat *prxstat; - poffset = (u8 *)prxcmdbuf; + poffset = prxcmdbuf; voffset = *(__le32 *)poffset; - prxstat = (struct recv_stat *)prxcmdbuf; + prxstat = prxcmdbuf; drvinfo_sz = (le32_to_cpu (prxstat->rxdw0) &0x000f0000 ) >>16 ; drvinfo_sz <<=3 ; poffset +=RXDESC_SIZE + drvinfo_sz;
@@ -635,7 +635,7 @@ void r8712_reordering_ctrl_timeout_handler(void *pcontext) {unsigned long irql;struct recv_reorder_ctrl *preorder_ctrl = - (struct recv_reorder_ctrl *)pcontext; + pcontext;struct _adapter *padapter = preorder_ctrl->padapter;struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
@@ -976,7 +976,7 @@ int recv_func(struct _adapter *padapter, void *pcontext)struct __queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue;struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - prframe = (union recv_frame *)pcontext; + prframe = pcontext; orig_prframe = prframe; pattrib = &prframe->u.hdr.attrib;if (check_fwstate (pmlmepriv,WIFI_MP_STATE )) {
@@ -1124,7 +1124,7 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)static void recv_tasklet (void *priv) {struct sk_buff *pskb; -struct _adapter *padapter = (struct _adapter *)priv; +struct _adapter *padapter = priv;struct recv_priv *precvpriv = &padapter->recvpriv;while (NULL != (pskb =skb_dequeue (&precvpriv->rx_skb_queue))) {
Signature · 1 line
2.7.4
Re: [Outreachy kernel] [PATCH 5/5] staging: rtl8712: Remove unnecessary cast on void pointer
drivers/staging/rtl8712/rtl8712_recv.c void r8712_reordering_ctrl_timeout_handler(void *pcontext) · line 638
Quoted 6 lines
drivers/staging/rtl8712/rtl8712_recv.c +1
-1@@ -635,7 +635,7 @@ void r8712_reordering_ctrl_timeout_handler(void *pcontext) {unsigned long irql;struct recv_reorder_ctrl *preorder_ctrl = - (struct recv_reorder_ctrl *)pcontext; + pcontext;
Coccinelle doesn't always generate code in the best way. pcontext can be moved up to the previous line in this case.
julia
Re: [Outreachy kernel] [PATCH 5/5] staging: rtl8712: Remove unnecessary cast on void pointer
Quoted 10 lines · Julia Lawall
drivers/staging/rtl8712/rtl8712_recv.c void r8712_reordering_ctrl_timeout_handler(void *pcontext) · line 638
Quoted 6 lines
drivers/staging/rtl8712/rtl8712_recv.c +1
-1@@ -635,7 +635,7 @@ void r8712_reordering_ctrl_timeout_handler(void *pcontext) {unsigned long irql;struct recv_reorder_ctrl *preorder_ctrl = - (struct recv_reorder_ctrl *)pcontext; + pcontext;Coccinelle doesn't always generate code in the best way. pcontext can be moved up to the previous line in this case.
Thanks,
I will send v2.
Quoted 1 line
julia