RE: checkpatch.pl report about "Missing blank line after declarations" in a structure definition
(I guess I need to refresh my regular expression skills ...) Thanks, this will be just great! Dotan > -Original Message- > From: Joe Perches [mailto:j...@perches.com] > Sent: Monday, August 04, 2014 6:27 PM > To: Dotan Barak > Cc: linux-kernel@vger.kernel.org > Subject: Re: checkpatch.pl report about "Missing blank line after > declarations" in a structure definition > > On Mon, 2014-08-04 at 15:19 +, Dotan Barak wrote: > > In our code (I take it as an example), we used > > MLX5_DECLARE_DOORBELL_LOCK, So I guess that the regular expression > > that you mentioned will fail on it (because the "_" is not allowed to be > repeated). > > > > So, I would change it a little bit to allow people to use underscore as a > > word > separator. > [] > > > Maybe: > > > > > > (?:$Storage\s+)(?:[A-Z_][A-Z0-9]+_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0- > > > 9]+){1,2} > > What I suggested should allow any of: > > DECLARE_FOO > _FOO_DEFINE_BAR > FOO_BAR_DEFINE_BAZ > FOO_BAR_DECLARE_BAZ_QUX > > where FOO/BAR/BAZ/QUX can also have digits -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: checkpatch.pl report about "Missing blank line after declarations" in a structure definition
In our code (I take it as an example), we used MLX5_DECLARE_DOORBELL_LOCK, So I guess that the regular expression that you mentioned will fail on it (because the "_" is not allowed to be repeated). So, I would change it a little bit to allow people to use underscore as a word separator. Thanks Dotan > > > > The following change worked for me: > > (?:$Storage\s+)?[A-Z0-9_]*(?:DECLARE|DEFINE)_[A-Z_]*\s*\(| > > > > But, maybe it is better to be even more general and allow: > > (?:$Storage\s+)?[A-Z0-9_]*(?:DECLARE|DEFINE)_[ A-Z0-9_]*\s*\(| > > Maybe: > > (?:$Storage\s+)(?:[A-Z_][A-Z0-9]+_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0- > 9]+){1,2} > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: checkpatch.pl report about "Missing blank line after declarations" in a structure definition
I think that allowing a prefix is reasonable (to allow modules to add more flexibility). I tried the suggested change and it still didn't work for me. The following change worked for me: (?:$Storage\s+)?[A-Z0-9_]*(?:DECLARE|DEFINE)_[A-Z_]*\s*\(| But, maybe it is better to be even more general and allow: (?:$Storage\s+)?[A-Z0-9_]*(?:DECLARE|DEFINE)_[ A-Z0-9_]*\s*\(| Thanks a lot for the quick (and great) response! Dotan > -Original Message- > From: Joe Perches [mailto:j...@perches.com] > Sent: Monday, August 04, 2014 5:27 PM > To: Dotan Barak > Cc: linux-kernel@vger.kernel.org > Subject: Re: checkpatch.pl report about "Missing blank line after > declarations" in a structure definition > > On Mon, 2014-08-04 at 14:14 +, Dotan Barak wrote: > > Hi Joe. > > > > The patch that you mentioned solved most of the issues, thanks! > > > > However, there is still one more warning of this type within a struct > declaration. > > > > # ./checkpatch.pl --file --no-tree ../include/linux/mlx5/driver.h > > > > WARNING: Missing a blank line after declarations > > #508: FILE: ../include/linux/mlx5/driver.h:508: > > + struct mlx5_uuar_info uuari; > > + MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); > > > > > > > > struct mlx5_priv { > > charname[MLX5_MAX_NAME_LEN]; > > struct mlx5_eq_tableeq_table; > > struct mlx5_uuar_info uuari; > > MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); > > MLX5_DECLARE_DOORBELL is not a "normal" DECLARE macro. > > Perhaps the exception for the DECLARE_ declaration macros in the > exceptions list: > > (?:$Storage\s+)?(?:DECLARE|DEFINE)_[A-Z]+\s*\(| > > could be expanded to: > > (?:$Storage\s+)?[A-Z0-9_]*(?:DECLARE|DEFINE)_[A-Z]+\s*\(| > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: checkpatch.pl report about "Missing blank line after declarations" in a structure definition
Hi Joe. The patch that you mentioned solved most of the issues, thanks! However, there is still one more warning of this type within a struct declaration. # ./checkpatch.pl --file --no-tree ../include/linux/mlx5/driver.h WARNING: Missing a blank line after declarations #508: FILE: ../include/linux/mlx5/driver.h:508: + struct mlx5_uuar_info uuari; + MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); struct mlx5_priv { charname[MLX5_MAX_NAME_LEN]; struct mlx5_eq_tableeq_table; struct mlx5_uuar_info uuari; MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); /* pages stuff */ struct workqueue_struct *pg_wq; struct rb_root page_root; int fw_pages; int reg_pages; struct list_headfree_list; Thanks Dotan > -Original Message- > From: Joe Perches [mailto:j...@perches.com] > Sent: Monday, August 04, 2014 4:36 PM > To: Dotan Barak > Cc: linux-kernel@vger.kernel.org > Subject: Re: checkpatch.pl report about "Missing blank line after > declarations" in a structure definition > > On Mon, 2014-08-04 at 11:20 +, Dotan Barak wrote: > > Hi Joe. > > > > Thanks for fixing the issue that I reported about. > > > > It seems that even after your fix, there is still a false warning of > > "Missing > blank line after declarations". > > > > I executed checkpatch.pl on a header file that exists in the Linux tree: > > # ./checkpatch.pl --file --no-tree ../include/linux/mlx5/cq.h > > > > And got the following warning: > > > > WARNING: Missing a blank line after declarations > > #49: FILE: ../include/linux/mlx5/cq.h:49: > > + int irqn; > > + void (*comp)(struct mlx5_core_cq *); > [] > > As you can see, this is a structure definition and IMHO the warning above is > false. > > The version in Linus' tree has a defect where this test doesn't recognize > function pointer declarations. > > This is fixed in -next since June, but it takes awhile to get into Linus' > tree. > > https://lkml.org/lkml/2014/6/6/426 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
checkpatch.pl report about "Missing blank line after declarations" in a structure definition
Hi Joe. Thanks for fixing the issue that I reported about. It seems that even after your fix, there is still a false warning of "Missing blank line after declarations". I executed checkpatch.pl on a header file that exists in the Linux tree: # ./checkpatch.pl --file --no-tree ../include/linux/mlx5/cq.h And got the following warning: WARNING: Missing a blank line after declarations #49: FILE: ../include/linux/mlx5/cq.h:49: + int irqn; + void (*comp)(struct mlx5_core_cq *); Here is the structure that checkpatch.pl is complaining about: struct mlx5_core_cq { u32 cqn; int cqe_sz; __be32 *set_ci_db; __be32 *arm_db; atomic_trefcount; struct completion free; unsignedvector; int irqn; void (*comp)(struct mlx5_core_cq *); void (*event) (struct mlx5_core_cq *, enum mlx5_event); struct mlx5_uar*uar; u32 cons_index; unsignedarm_sn; struct mlx5_rsc_debug *dbg; int pid; }; As you can see, this is a structure definition and IMHO the warning above is false. Thanks! Dotan Barak Sr. Staff Engineer, Windows verification Mellanox Technologies Beit Mellanox Yokneam, 20692 Office: +972-74-7236271 Fax: +972-4-9593245 www.mellanox.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
checkpatch.pl report about Missing blank line after declarations in a structure definition
Hi Joe. Thanks for fixing the issue that I reported about. It seems that even after your fix, there is still a false warning of Missing blank line after declarations. I executed checkpatch.pl on a header file that exists in the Linux tree: # ./checkpatch.pl --file --no-tree ../include/linux/mlx5/cq.h And got the following warning: WARNING: Missing a blank line after declarations #49: FILE: ../include/linux/mlx5/cq.h:49: + int irqn; + void (*comp)(struct mlx5_core_cq *); Here is the structure that checkpatch.pl is complaining about: snip start struct mlx5_core_cq { u32 cqn; int cqe_sz; __be32 *set_ci_db; __be32 *arm_db; atomic_trefcount; struct completion free; unsignedvector; int irqn; void (*comp)(struct mlx5_core_cq *); void (*event) (struct mlx5_core_cq *, enum mlx5_event); struct mlx5_uar*uar; u32 cons_index; unsignedarm_sn; struct mlx5_rsc_debug *dbg; int pid; }; snip end As you can see, this is a structure definition and IMHO the warning above is false. Thanks! Dotan Barak Sr. Staff Engineer, Windows verification Mellanox Technologies Beit Mellanox Yokneam, 20692 Office: +972-74-7236271 Fax: +972-4-9593245 www.mellanox.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: checkpatch.pl report about Missing blank line after declarations in a structure definition
Hi Joe. The patch that you mentioned solved most of the issues, thanks! However, there is still one more warning of this type within a struct declaration. # ./checkpatch.pl --file --no-tree ../include/linux/mlx5/driver.h WARNING: Missing a blank line after declarations #508: FILE: ../include/linux/mlx5/driver.h:508: + struct mlx5_uuar_info uuari; + MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); snip start struct mlx5_priv { charname[MLX5_MAX_NAME_LEN]; struct mlx5_eq_tableeq_table; struct mlx5_uuar_info uuari; MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); /* pages stuff */ struct workqueue_struct *pg_wq; struct rb_root page_root; int fw_pages; int reg_pages; struct list_headfree_list; snip end Thanks Dotan -Original Message- From: Joe Perches [mailto:j...@perches.com] Sent: Monday, August 04, 2014 4:36 PM To: Dotan Barak Cc: linux-kernel@vger.kernel.org Subject: Re: checkpatch.pl report about Missing blank line after declarations in a structure definition On Mon, 2014-08-04 at 11:20 +, Dotan Barak wrote: Hi Joe. Thanks for fixing the issue that I reported about. It seems that even after your fix, there is still a false warning of Missing blank line after declarations. I executed checkpatch.pl on a header file that exists in the Linux tree: # ./checkpatch.pl --file --no-tree ../include/linux/mlx5/cq.h And got the following warning: WARNING: Missing a blank line after declarations #49: FILE: ../include/linux/mlx5/cq.h:49: + int irqn; + void (*comp)(struct mlx5_core_cq *); [] As you can see, this is a structure definition and IMHO the warning above is false. The version in Linus' tree has a defect where this test doesn't recognize function pointer declarations. This is fixed in -next since June, but it takes awhile to get into Linus' tree. https://lkml.org/lkml/2014/6/6/426 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: checkpatch.pl report about Missing blank line after declarations in a structure definition
I think that allowing a prefix is reasonable (to allow modules to add more flexibility). I tried the suggested change and it still didn't work for me. The following change worked for me: (?:$Storage\s+)?[A-Z0-9_]*(?:DECLARE|DEFINE)_[A-Z_]*\s*\(| But, maybe it is better to be even more general and allow: (?:$Storage\s+)?[A-Z0-9_]*(?:DECLARE|DEFINE)_[ A-Z0-9_]*\s*\(| Thanks a lot for the quick (and great) response! Dotan -Original Message- From: Joe Perches [mailto:j...@perches.com] Sent: Monday, August 04, 2014 5:27 PM To: Dotan Barak Cc: linux-kernel@vger.kernel.org Subject: Re: checkpatch.pl report about Missing blank line after declarations in a structure definition On Mon, 2014-08-04 at 14:14 +, Dotan Barak wrote: Hi Joe. The patch that you mentioned solved most of the issues, thanks! However, there is still one more warning of this type within a struct declaration. # ./checkpatch.pl --file --no-tree ../include/linux/mlx5/driver.h WARNING: Missing a blank line after declarations #508: FILE: ../include/linux/mlx5/driver.h:508: + struct mlx5_uuar_info uuari; + MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); snip start struct mlx5_priv { charname[MLX5_MAX_NAME_LEN]; struct mlx5_eq_tableeq_table; struct mlx5_uuar_info uuari; MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); MLX5_DECLARE_DOORBELL is not a normal DECLARE macro. Perhaps the exception for the DECLARE_FOO declaration macros in the exceptions list: (?:$Storage\s+)?(?:DECLARE|DEFINE)_[A-Z]+\s*\(| could be expanded to: (?:$Storage\s+)?[A-Z0-9_]*(?:DECLARE|DEFINE)_[A-Z]+\s*\(| -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: checkpatch.pl report about Missing blank line after declarations in a structure definition
In our code (I take it as an example), we used MLX5_DECLARE_DOORBELL_LOCK, So I guess that the regular expression that you mentioned will fail on it (because the _ is not allowed to be repeated). So, I would change it a little bit to allow people to use underscore as a word separator. Thanks Dotan The following change worked for me: (?:$Storage\s+)?[A-Z0-9_]*(?:DECLARE|DEFINE)_[A-Z_]*\s*\(| But, maybe it is better to be even more general and allow: (?:$Storage\s+)?[A-Z0-9_]*(?:DECLARE|DEFINE)_[ A-Z0-9_]*\s*\(| Maybe: (?:$Storage\s+)(?:[A-Z_][A-Z0-9]+_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0- 9]+){1,2} -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: checkpatch.pl report about Missing blank line after declarations in a structure definition
(I guess I need to refresh my regular expression skills ...) Thanks, this will be just great! Dotan -Original Message- From: Joe Perches [mailto:j...@perches.com] Sent: Monday, August 04, 2014 6:27 PM To: Dotan Barak Cc: linux-kernel@vger.kernel.org Subject: Re: checkpatch.pl report about Missing blank line after declarations in a structure definition On Mon, 2014-08-04 at 15:19 +, Dotan Barak wrote: In our code (I take it as an example), we used MLX5_DECLARE_DOORBELL_LOCK, So I guess that the regular expression that you mentioned will fail on it (because the _ is not allowed to be repeated). So, I would change it a little bit to allow people to use underscore as a word separator. [] Maybe: (?:$Storage\s+)(?:[A-Z_][A-Z0-9]+_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0- 9]+){1,2} What I suggested should allow any of: DECLARE_FOO _FOO_DEFINE_BAR FOO_BAR_DEFINE_BAZ FOO_BAR_DECLARE_BAZ_QUX where FOO/BAR/BAZ/QUX can also have digits -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: The code segment of the user level in PPC64 are in VMAs with write permissions
Eric Dumazet wrote: This is because on PPC architecture, address of a function points to a small data area (a function descriptor) where the caller can find informations about : - Address (in the text segment, so readonly) of the target function - Address of the TOC for this function. http://www.linux-foundation.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#FUNC-ADDRESS thank you very much for clearing this issue. Dotan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: The code segment of the user level in PPC64 are in VMAs with write permissions
Eric Dumazet wrote: This is because on PPC architecture, address of a function points to a small data area (a function descriptor) where the caller can find informations about : - Address (in the text segment, so readonly) of the target function - Address of the TOC for this function. http://www.linux-foundation.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#FUNC-ADDRESS thank you very much for clearing this issue. Dotan -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
The code segment of the user level in PPC64 are in VMAs with write permissions
Hi all. I noticed that the code segment of the user level in PPC64 machines is in a VMA with a write permission enabled. I'm using the following machine attributes: * Host Name : mtlsqt185 Host Architecture : ppc64 Linux Distribution: SUSE Linux Enterprise Server 10 (ppc) VERSION = 10 PATCHLEVEL = 1 Kernel Version: 2.6.16.53-0.16-ppc64 GCC Version : gcc (GCC) 4.1.2 20070115 (prerelease) (SUSE Linux) Memory size : 1740232 kB Number of CPUs: 8 cpu MHz : 4005.00MHz Driver Version: OFED-1.2.5.4-20071210-0614 HCA ID(s) : mlx4_0 HCA model(s) : 25418 FW version(s) : 2.3.906 Board(s) : IBM08A001 * I printed the address of a function in my program and i got the value 0x1005ac80. I printed the VMAs in my process and i got the following output: mtlsqt185:~ # cat /proc/17366/maps 0010-00103000 r-xp 0010 00:00 0 1000-1004a000 r-xp 08:03 1063667 /tmp/tsscr/svn.mlx_tp/branches/ofed1.2.5/gen2/userspace/useraccess/gen2_basic/gen2_basic 1005a000-1005e000 rw-p 0004a000 08:03 1063667 /tmp/tsscr/svn.mlx_tp/branches/ofed1.2.5/gen2/userspace/useraccess/gen2_basic/gen2_basic 1005e000-1015f000 rw-p 1005e000 00:00 0 [heap] Is this is a security hole (any virus can change the code in the code segment ...) can you please CC me the answers o this question? thanks Dotan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
The code segment of the user level in PPC64 are in VMAs with write permissions
Hi all. I noticed that the code segment of the user level in PPC64 machines is in a VMA with a write permission enabled. I'm using the following machine attributes: * Host Name : mtlsqt185 Host Architecture : ppc64 Linux Distribution: SUSE Linux Enterprise Server 10 (ppc) VERSION = 10 PATCHLEVEL = 1 Kernel Version: 2.6.16.53-0.16-ppc64 GCC Version : gcc (GCC) 4.1.2 20070115 (prerelease) (SUSE Linux) Memory size : 1740232 kB Number of CPUs: 8 cpu MHz : 4005.00MHz Driver Version: OFED-1.2.5.4-20071210-0614 HCA ID(s) : mlx4_0 HCA model(s) : 25418 FW version(s) : 2.3.906 Board(s) : IBM08A001 * I printed the address of a function in my program and i got the value 0x1005ac80. I printed the VMAs in my process and i got the following output: mtlsqt185:~ # cat /proc/17366/maps 0010-00103000 r-xp 0010 00:00 0 1000-1004a000 r-xp 08:03 1063667 /tmp/tsscr/svn.mlx_tp/branches/ofed1.2.5/gen2/userspace/useraccess/gen2_basic/gen2_basic 1005a000-1005e000 rw-p 0004a000 08:03 1063667 /tmp/tsscr/svn.mlx_tp/branches/ofed1.2.5/gen2/userspace/useraccess/gen2_basic/gen2_basic 1005e000-1015f000 rw-p 1005e000 00:00 0 [heap] Is this is a security hole (any virus can change the code in the code segment ...) can you please CC me the answers o this question? thanks Dotan -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/