From mboxrd@z Thu Jan 1 00:00:00 1970 From: Theodore Tso Subject: Re: [PATCH v4 12/12] tree-wide: convert open calls to remove spaces to skip_spaces() lib function Date: Sun, 8 Nov 2009 13:47:22 -0500 Message-ID: <20091108184722.GA1647@mit.edu> References: <7d5883637aa976b54e944998f635d47a41618a75.1257602781.git.andre.goddard@gmail.com> Reply-To: Linux filesystem caching discussion list Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <7d5883637aa976b54e944998f635d47a41618a75.1257602781.git.andre.goddard@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cachefs-bounces@redhat.com Errors-To: linux-cachefs-bounces@redhat.com To: =?iso-8859-1?Q?Andr=E9?= Goddard Rosa Cc: Pavel Roskin , Stefan Haberland , Jan Kara , linux-cachefs@redhat.com, Mike Snitzer , Neil Brown , Frederic Weisbecker , Jens Axboe , Heiko Carstens , "James E . J . Bottomley" , ibm-acpi-devel@lists.sourceforge.net, dm-devel@redhat.com, Julia Lawall , "H . Peter Anvin" , Daire Byrne , Alasdair G Kergon , Greg Banks , Stefan Weinhuber , Eric Sandeen , Adam Belay , Helge Deller , x86@kernel.org, James Morris , Takashi Iwai , Ingo Molnar , Alan Cox List-Id: linux-raid.ids On Sat, Nov 07, 2009 at 01:16:20PM -0200, Andr=E9 Goddard Rosa wrote: > Makes use of skip_spaces() defined in lib/string.c for removing leading > spaces from strings all over the tree. >=20 > Also, while at it, if we see (*str && isspace(*str)), we can be sure to > remove the first condition (*str) as the second one (isspace(*str)) als= o > evaluates to 0 whenever *str =3D=3D 0, making it redundant. In other wo= rds, > "a char equals zero is never a space". There are a number of places that have the pattern of skipping whitespace, calling simpler_strtoul(), and then skipping whitespace afterwards. And thinkpad_acpi.c and fs/ext4/super.c both have an indentical function, parse_strotul(), which basically does this plus doing actual error checking (a number of callers of simple_strtoul aren't checking to see if the user passed in a valid number or not, boo.) I would suggest that we should lift parse_strtoul() into lib/, both to save a bit of code, as well as encouraging people to do proper input validation, while we are doing this tree-wide cleanup. - Ted From mboxrd@z Thu Jan 1 00:00:00 1970 From: Theodore Tso Subject: Re: [PATCH v4 12/12] tree-wide: convert open calls to remove spaces to skip_spaces() lib function Date: Sun, 8 Nov 2009 13:47:22 -0500 Message-ID: <20091108184722.GA1647@mit.edu> References: <7d5883637aa976b54e944998f635d47a41618a75.1257602781.git.andre.goddard@gmail.com> Reply-To: Linux filesystem caching discussion list Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Cc: Pavel Roskin , Stefan Haberland , Jan Kara , linux-cachefs@redhat.com, Mike Snitzer , Neil Brown , Frederic Weisbecker , Jens Axboe , Heiko Carstens , "James E . J . Bottomley" , ibm-acpi-devel@lists.sourceforge.net, dm-devel@redhat.com, Julia Lawall , "H . Peter Anvin" , Daire Byrne , Alasdair G Kergon , Greg Banks , Stefan Weinhuber , Eric Sandeen , Adam Belay , Helge Deller , x86@kernel.org, James Morris , Takashi Iwai , Ingo Molnar , Alan Cox Return-path: In-Reply-To: <7d5883637aa976b54e944998f635d47a41618a75.1257602781.git.andre.goddard@gmail.com> List-Id: Linux filesystem caching discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-cachefs-bounces@redhat.com On Sat, Nov 07, 2009 at 01:16:20PM -0200, Andr=E9 Goddard Rosa wrote: > Makes use of skip_spaces() defined in lib/string.c for removing leading > spaces from strings all over the tree. >=20 > Also, while at it, if we see (*str && isspace(*str)), we can be sure to > remove the first condition (*str) as the second one (isspace(*str)) als= o > evaluates to 0 whenever *str =3D=3D 0, making it redundant. In other wo= rds, > "a char equals zero is never a space". There are a number of places that have the pattern of skipping whitespace, calling simpler_strtoul(), and then skipping whitespace afterwards. And thinkpad_acpi.c and fs/ext4/super.c both have an indentical function, parse_strotul(), which basically does this plus doing actual error checking (a number of callers of simple_strtoul aren't checking to see if the user passed in a valid number or not, boo.) I would suggest that we should lift parse_strtoul() into lib/, both to save a bit of code, as well as encouraging people to do proper input validation, while we are doing this tree-wide cleanup. - Ted From mboxrd@z Thu Jan 1 00:00:00 1970 From: Theodore Tso Subject: Re: [PATCH v4 12/12] tree-wide: convert open calls to remove spaces to skip_spaces() lib function Date: Sun, 8 Nov 2009 13:47:22 -0500 Message-ID: <20091108184722.GA1647@mit.edu> References: <7d5883637aa976b54e944998f635d47a41618a75.1257602781.git.andre.goddard@gmail.com> Reply-To: Linux filesystem caching discussion list Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Pavel Roskin , Stefan Haberland , Jan Kara , linux-cachefs@redhat.com, Mike Snitzer , Neil Brown , Frederic Weisbecker , Jens Axboe , Heiko Carstens , "James E . J . Bottomley" , ibm-acpi-devel@lists.sourceforge.net, dm-devel@redhat.com, Julia Lawall , "H . Peter Anvin" , Daire Byrne , Alasdair G Kergon , Greg Banks , Stefan Weinhuber , Eric Sandeen , Adam Belay , Helge Deller , x86@kernel.org, James Morris , Takashi Iwai , Ingo Molnar , Alan Cox Return-path: Content-Disposition: inline In-Reply-To: <7d5883637aa976b54e944998f635d47a41618a75.1257602781.git.andre.goddard@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cachefs-bounces@redhat.com Errors-To: linux-cachefs-bounces@redhat.com List-Id: netdev.vger.kernel.org On Sat, Nov 07, 2009 at 01:16:20PM -0200, Andr=E9 Goddard Rosa wrote: > Makes use of skip_spaces() defined in lib/string.c for removing leading > spaces from strings all over the tree. >=20 > Also, while at it, if we see (*str && isspace(*str)), we can be sure to > remove the first condition (*str) as the second one (isspace(*str)) als= o > evaluates to 0 whenever *str =3D=3D 0, making it redundant. In other wo= rds, > "a char equals zero is never a space". There are a number of places that have the pattern of skipping whitespace, calling simpler_strtoul(), and then skipping whitespace afterwards. And thinkpad_acpi.c and fs/ext4/super.c both have an indentical function, parse_strotul(), which basically does this plus doing actual error checking (a number of callers of simple_strtoul aren't checking to see if the user passed in a valid number or not, boo.) I would suggest that we should lift parse_strtoul() into lib/, both to save a bit of code, as well as encouraging people to do proper input validation, while we are doing this tree-wide cleanup. - Ted From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sun, 8 Nov 2009 13:47:22 -0500 From: Theodore Tso Message-ID: <20091108184722.GA1647@mit.edu> References: <7d5883637aa976b54e944998f635d47a41618a75.1257602781.git.andre.goddard@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <7d5883637aa976b54e944998f635d47a41618a75.1257602781.git.andre.goddard@gmail.com> Subject: Re: [uml-devel] [PATCH v4 12/12] tree-wide: convert open calls to remove spaces to skip_spaces() lib function List-Id: The user-mode Linux development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: user-mode-linux-devel-bounces@lists.sourceforge.net To: =?iso-8859-1?Q?Andr=E9?= Goddard Rosa Cc: Pavel Roskin , Stefan Haberland , Jan Kara , linux-cachefs@redhat.com, Mike Snitzer , Neil Brown , Frederic Weisbecker , Jens Axboe , Heiko Carstens , Steve Dickson , "James E . J . Bottomley" , David Howells , ibm-acpi-devel@lists.sourceforge.net, dm-devel@redhat.com, Julia Lawall , "H . Peter Anvin" , Daire Byrne , Alasdair G Kergon , Greg Banks , Stefan Weinhuber , Eric Sandeen , Adam Belay , Helge Deller , x86@kernel.org, James Morris , Takashi Iwai , Ingo Molnar , Alan Cox , WANG Cong , Roman Hoog Antink , linux-ext4@vger.kernel.org, Alexey Dobriyan , Andrea Righi , alsa-devel@alsa-project.org, Len Brown , Samuel Ortiz , coreteam@netfilter.org, user-mode-linux-devel@lists.sourceforge.net, linux-s390@vger.kernel.org, Trond Myklebust , Jeff Dike , Rusty Russell , Henrique de Moraes Holschuh , Sitsofe Wheeler , Steven Rostedt , linux-raid@vger.kernel.org, Martin Schwidefsky , Andreas Dilger , Pekka Enberg , Mikulas Patocka , Al Viro , user-mode-linux-user@lists.sourceforge.net, Jaroslav Kysela , Thomas Gleixner , Michael Holzheu , Arjan van de Ven , Jan Engelhardt , Bjorn Helgaas , Andre Noll , netfilter-devel@vger.kernel.org, linux-parisc@vger.kernel.org, "Martin K . Petersen" , netdev@vger.kernel.org, Jason Baron , Greg Kroah-Hartman , Roel Kluin , linux-kernel@vger.kernel.org, Stoyan Gaydarov , Patrick McHardy , Kyle McMartin , Christof Schmitt , netfilter@vger.kernel.org, Richard Purdie , Joe Perches , linux390@de.ibm.com, Andrew Morton , Andrey Borzenkov , "David S . Miller" On Sat, Nov 07, 2009 at 01:16:20PM -0200, Andr=E9 Goddard Rosa wrote: > Makes use of skip_spaces() defined in lib/string.c for removing leading > spaces from strings all over the tree. > = > Also, while at it, if we see (*str && isspace(*str)), we can be sure to > remove the first condition (*str) as the second one (isspace(*str)) also > evaluates to 0 whenever *str =3D=3D 0, making it redundant. In other word= s, > "a char equals zero is never a space". There are a number of places that have the pattern of skipping whitespace, calling simpler_strtoul(), and then skipping whitespace afterwards. And thinkpad_acpi.c and fs/ext4/super.c both have an indentical function, parse_strotul(), which basically does this plus doing actual error checking (a number of callers of simple_strtoul aren't checking to see if the user passed in a valid number or not, boo.) I would suggest that we should lift parse_strtoul() into lib/, both to save a bit of code, as well as encouraging people to do proper input validation, while we are doing this tree-wide cleanup. - Ted ---------------------------------------------------------------------------= --- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day = trial. Simplify your report design, integration and deployment - and focus = on = what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel