mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@linux.intel.com>
To: Himangi Saraogi <himangi774@gmail.com>
Cc: linux-kernel@vger.kernel.org, julia.lawall@lip6.fr
Subject: Re: [PATCH] i2o/memory.c : Use kstrdup
Date: Tue, 10 Jun 2014 17:45:24 +0100	[thread overview]
Message-ID: <1402418724.13849.149.camel@acox1-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20140610161113.GA3989@himangi-Dell>

On Tue, 2014-06-10 at 21:41 +0530, Himangi Saraogi wrote:
> Use kstrdup when the goal of an allocation is copy a string into the
> allocated region.
> 
> The Coccinelle semantic patch that makes this change is as follows:
> 
> // <smpl>
> @@
> expression from,to;
> expression flag,E1,E2;
> statement S;
> @@
> 
> -  to = kmalloc(strlen(from) + 1,flag);
> +  to = kstrdup(from, flag);
>    ... when != \(from = E1 \| to = E1 \)
>    if (to==NULL || ...) S
>    ... when != \(from = E2 \| to = E2 \)
> -  strcpy(to, from);
> // </smpl>
> 
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> ---
> To send to: linux-kernel@vger.kernel.org
>  drivers/message/i2o/memory.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)


I no longer have any I2O hardware so I'm unable to test this. Looks
right but does anyone actually still use these drivers ????

Alan



      reply	other threads:[~2014-06-10 16:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 16:11 Himangi Saraogi
2014-06-10 16:45 ` Alan Cox [this message]

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=1402418724.13849.149.camel@acox1-desk.ger.corp.intel.com \
    --to=alan@linux.intel.com \
    --cc=himangi774@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®