All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully
@ 2007-07-31 16:46 Neil Horman
  2007-07-31 16:52 ` Jeremy Fitzhardinge
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Neil Horman @ 2007-07-31 16:46 UTC (permalink / raw)
  To: akpm, jeremy, linux-kernel; +Cc: nhorman

As Jeremy and I had discussed in a previous thread, it would be nice if the
argv_split library function could gracefully handle a NULL pointer in the argcp
parameter, so as to allow functions using it that did not care about the value
of argc to not have to declare a useless variable.  This patch accomplishes
that.  Tested by me, with successful results.

Thanks & Regards
Neil

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>


 argv_split.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


diff --git a/lib/argv_split.c b/lib/argv_split.c
index 4096ed4..fad6ce4 100644
--- a/lib/argv_split.c
+++ b/lib/argv_split.c
@@ -75,7 +75,9 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp)
 	if (argv == NULL)
 		goto out;
 
-	*argcp = argc;
+	if (argcp)
+		*argcp = argc;
+
 	argvp = argv;
 
 	while (*str) {
-- 
/***************************************************
 *Neil Horman
 *Software Engineer
 *Red Hat, Inc.
 *nhorman@tuxdriver.com
 *gpg keyid: 1024D / 0x92A74FA1
 *http://pgp.mit.edu
 ***************************************************/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully
  2007-07-31 16:46 [PATCH] argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully Neil Horman
@ 2007-07-31 16:52 ` Jeremy Fitzhardinge
  2007-07-31 16:56 ` Jeremy Fitzhardinge
  2007-07-31 17:36 ` Satyam Sharma
  2 siblings, 0 replies; 6+ messages in thread
From: Jeremy Fitzhardinge @ 2007-07-31 16:52 UTC (permalink / raw)
  To: Neil Horman; +Cc: akpm, linux-kernel

Neil Horman wrote:
> As Jeremy and I had discussed in a previous thread, it would be nice if the
> argv_split library function could gracefully handle a NULL pointer in the argcp
> parameter, so as to allow functions using it that did not care about the value
> of argc to not have to declare a useless variable.  This patch accomplishes
> that.  Tested by me, with successful results.
>
>   

Looks good to me.

    J

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully
  2007-07-31 16:46 [PATCH] argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully Neil Horman
  2007-07-31 16:52 ` Jeremy Fitzhardinge
@ 2007-07-31 16:56 ` Jeremy Fitzhardinge
  2007-07-31 17:12   ` Neil Horman
  2007-07-31 17:36 ` Satyam Sharma
  2 siblings, 1 reply; 6+ messages in thread
From: Jeremy Fitzhardinge @ 2007-07-31 16:56 UTC (permalink / raw)
  To: Neil Horman; +Cc: akpm, linux-kernel

Neil Horman wrote:
> As Jeremy and I had discussed in a previous thread, it would be nice if the
> argv_split library function could gracefully handle a NULL pointer in the argcp
> parameter, so as to allow functions using it that did not care about the value
> of argc to not have to declare a useless variable.  This patch accomplishes
> that.  Tested by me, with successful results.
>   

Oh, one other thing.  Could you do a patch to clean up the use in the
usermodehelper code?

    J
> Thanks & Regards
> Neil
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
>
>
>  argv_split.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
>
> diff --git a/lib/argv_split.c b/lib/argv_split.c
> index 4096ed4..fad6ce4 100644
> --- a/lib/argv_split.c
> +++ b/lib/argv_split.c
> @@ -75,7 +75,9 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp)
>  	if (argv == NULL)
>  		goto out;
>  
> -	*argcp = argc;
> +	if (argcp)
> +		*argcp = argc;
> +
>  	argvp = argv;
>  
>  	while (*str) {
>   


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully
  2007-07-31 16:56 ` Jeremy Fitzhardinge
@ 2007-07-31 17:12   ` Neil Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Neil Horman @ 2007-07-31 17:12 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: akpm, linux-kernel

On Tue, Jul 31, 2007 at 09:56:35AM -0700, Jeremy Fitzhardinge wrote:
> Neil Horman wrote:
> > As Jeremy and I had discussed in a previous thread, it would be nice if the
> > argv_split library function could gracefully handle a NULL pointer in the argcp
> > parameter, so as to allow functions using it that did not care about the value
> > of argc to not have to declare a useless variable.  This patch accomplishes
> > that.  Tested by me, with successful results.
> >   
> 
> Oh, one other thing.  Could you do a patch to clean up the use in the
> usermodehelper code?
> 
I have a patch for it already, which is rolled into some other work I'm doing in
there.  Since I had a bit of a false start with the recent coredump work, now
that its in -mm I want to give that a chance to settle out and get some testing.
Once its gotten a few weeks of testing and no one else pops up with some other
requests/additions/etc, I'll post my cleanups, which will include your request
above.

Regards
Neil

>     J
> > Thanks & Regards
> > Neil
> >
> > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> >
> >
> >  argv_split.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> >
> > diff --git a/lib/argv_split.c b/lib/argv_split.c
> > index 4096ed4..fad6ce4 100644
> > --- a/lib/argv_split.c
> > +++ b/lib/argv_split.c
> > @@ -75,7 +75,9 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp)
> >  	if (argv == NULL)
> >  		goto out;
> >  
> > -	*argcp = argc;
> > +	if (argcp)
> > +		*argcp = argc;
> > +
> >  	argvp = argv;
> >  
> >  	while (*str) {
> >   

-- 
/***************************************************
 *Neil Horman
 *Software Engineer
 *Red Hat, Inc.
 *nhorman@tuxdriver.com
 *gpg keyid: 1024D / 0x92A74FA1
 *http://pgp.mit.edu
 ***************************************************/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully
  2007-07-31 16:46 [PATCH] argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully Neil Horman
  2007-07-31 16:52 ` Jeremy Fitzhardinge
  2007-07-31 16:56 ` Jeremy Fitzhardinge
@ 2007-07-31 17:36 ` Satyam Sharma
  2007-07-31 18:14   ` Neil Horman
  2 siblings, 1 reply; 6+ messages in thread
From: Satyam Sharma @ 2007-07-31 17:36 UTC (permalink / raw)
  To: Neil Horman; +Cc: akpm, jeremy, linux-kernel



On Tue, 31 Jul 2007, Neil Horman wrote:

> As Jeremy and I had discussed in a previous thread, it would be nice if the
> argv_split library function could gracefully handle a NULL pointer in the argcp
> parameter, so as to allow functions using it that did not care about the value
> of argc to not have to declare a useless variable.  This patch accomplishes
> that.  Tested by me, with successful results.

The patch itself looks simple and straightforward enough, but having done
this, now you'd also want to cleanup the use of the dummy variable in the
callsites you mentioned above, correct? (Unless that's what Jeremy meant
in his reply already)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully
  2007-07-31 17:36 ` Satyam Sharma
@ 2007-07-31 18:14   ` Neil Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Neil Horman @ 2007-07-31 18:14 UTC (permalink / raw)
  To: Satyam Sharma; +Cc: akpm, jeremy, linux-kernel

On Tue, Jul 31, 2007 at 11:06:52PM +0530, Satyam Sharma wrote:
> 
> 
> On Tue, 31 Jul 2007, Neil Horman wrote:
> 
> > As Jeremy and I had discussed in a previous thread, it would be nice if the
> > argv_split library function could gracefully handle a NULL pointer in the argcp
> > parameter, so as to allow functions using it that did not care about the value
> > of argc to not have to declare a useless variable.  This patch accomplishes
> > that.  Tested by me, with successful results.
> 
> The patch itself looks simple and straightforward enough, but having done
> this, now you'd also want to cleanup the use of the dummy variable in the
> callsites you mentioned above, correct? (Unless that's what Jeremy meant
> in his reply already)

yes, and as I've already replied, I have this patch ready.  however, I've got
some other work that I'm doing in one of the callsites, and since there are only
currently two sites, one of which already has some pending changesets in -mm,
I'm waiting for those to get some testing first. Once there are no
issues/requests with my current changesets, I'll be submitting a patch with the
cleanup of the callsites, along with some other changes.

regards
Neil

-- 
/***************************************************
 *Neil Horman
 *Software Engineer
 *Red Hat, Inc.
 *nhorman@tuxdriver.com
 *gpg keyid: 1024D / 0x92A74FA1
 *http://pgp.mit.edu
 ***************************************************/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-07-31 18:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-31 16:46 [PATCH] argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully Neil Horman
2007-07-31 16:52 ` Jeremy Fitzhardinge
2007-07-31 16:56 ` Jeremy Fitzhardinge
2007-07-31 17:12   ` Neil Horman
2007-07-31 17:36 ` Satyam Sharma
2007-07-31 18:14   ` Neil Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.