All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Gargi Sharma <gs051095@gmail.com>,
	outreachy-kernel@googlegroups.com, gregkh@linuxfoundation.org,
	johan@kernel.org, elder@kernel.org
Subject: Re: [Outreachy kernel] [PATCH] staging: greybus: loop variable to loop index
Date: Tue, 21 Feb 2017 19:19:50 +0100	[thread overview]
Message-ID: <20170221181950.GD10245@localhost> (raw)
In-Reply-To: <alpine.DEB.2.20.1702211830560.3448@hadrien>

On Tue, Feb 21, 2017 at 06:31:28PM +0100, Julia Lawall wrote:
> On Tue, 21 Feb 2017, Gargi Sharma wrote:
> 
> > Change array index from the loop bound variable to loop index.
> > Once all the loopback devices have been found, free the pointer
> > array containing the dirent structures. The pointer to dirent
> > structures must be individually freed before freeing the pointer
> > array.
> >
> > Coccinelle Script:
> > @@
> > expression arr,ex1,ex2;
> > @@
> >
> > for(ex1 = 0; ex1 < ex2; ex1++) { <...
> >   arr[
> > - ex2
> > + ex1
> >   ]
> >   ...> }

Another good catch, but you should change the patch summary to something
more descriptive (and less detailed) like:

	staging: greybus: loopback_test: fix device-name leak

and possibly also make it more clear from the commit message that we've
been leaking these strings whenever there have been more than one
loopback device. (The memory is returned once the test program exits,
but still).

Care to send a v2 with those changes?

> > Signed-off-by: Gargi Sharma <gs051095@gmail.com>
> > ---
> >  drivers/staging/greybus/tools/loopback_test.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c
> > index 18d7a3d..1c01833 100644
> > --- a/drivers/staging/greybus/tools/loopback_test.c
> > +++ b/drivers/staging/greybus/tools/loopback_test.c
> > @@ -636,7 +636,7 @@ int find_loopback_devices(struct loopback_test *t)
> >  	ret = 0;
> >  done:
> >  	for (i = 0; i < n; i++)
> > -		free(namelist[n]);
> > +		free(namelist[i]);
> 
> I guess this is a test, so no one ever tried running it :)

It is a test tool, but we've been using it quite a bit.

Thanks,
Johan


  reply	other threads:[~2017-02-21 18:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 16:59 [PATCH] staging: greybus: loop variable to loop index Gargi Sharma
2017-02-21 17:31 ` [Outreachy kernel] " Julia Lawall
2017-02-21 18:19   ` Johan Hovold [this message]
2017-02-21 19:50     ` Julia Lawall
2017-02-21 19:54       ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170221181950.GD10245@localhost \
    --to=johan@kernel.org \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gs051095@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=outreachy-kernel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.