All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
To: "Wei,Jiangang" <weijg.fnst@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v2 1/5] kernel/syscalls/ipc/lib: Don't allocate memory for getpwnam()
Date: Tue, 12 May 2015 16:02:13 +0800	[thread overview]
Message-ID: <5551B385.6080506@cn.fujitsu.com> (raw)
In-Reply-To: <1431412049-24348-1-git-send-email-weijg.fnst@cn.fujitsu.com>


Applied all, thank you.

Wanlong Gao

On 05/12/2015 02:27 PM, Wei,Jiangang wrote:
> The getpwnam() function returns a pointer for a passwd
> structure. So,
> It's enough to declare a pointer to this structure,
> not to allocate memory for it.
> 
> Signed-off-by: Wei,Jiangang <weijg.fnst@cn.fujitsu.com>
> ---
>  testcases/kernel/syscalls/ipc/lib/libipc.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/ipc/lib/libipc.c b/testcases/kernel/syscalls/ipc/lib/libipc.c
> index f10e257..4de7faa 100644
> --- a/testcases/kernel/syscalls/ipc/lib/libipc.c
> +++ b/testcases/kernel/syscalls/ipc/lib/libipc.c
> @@ -143,12 +143,6 @@ int getuserid(char *user)
>  {
>  	struct passwd *ent;
>  
> -	/* allocate some space for the passwd struct */
> -	if ((ent = malloc(sizeof(struct passwd))) == NULL) {
> -		tst_brkm(TBROK, cleanup, "couldn't allocate space for passwd"
> -			 " structure");
> -	}
> -
>  	/* get the uid value for the user */
>  	if ((ent = getpwnam(user)) == NULL) {
>  		tst_brkm(TBROK, cleanup, "Couldn't get password entry for %s",
> 


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

      parent reply	other threads:[~2015-05-12  8:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12  6:27 [LTP] [PATCH v2 1/5] kernel/syscalls/ipc/lib: Don't allocate memory for getpwnam() Wei,Jiangang
2015-05-12  6:27 ` [LTP] [PATCH v2 2/5] kernel/mem/hugetlb/lib: remove unused codes " Wei,Jiangang
2015-05-12  6:27 ` [LTP] [PATCH v2 3/5] kernel/syscalls/dup2: optimize allocation and free Wei,Jiangang
2015-05-12  6:27 ` [LTP] [PATCH v2 4/5] kernel/syscalls/fallocate: adjust fclose's position Wei,Jiangang
2015-05-12  6:27 ` [LTP] [PATCH v2 5/5] kernel/mem/mmapstress: avoid resource leak Wei,Jiangang
2015-05-12  8:02 ` Wanlong Gao [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=5551B385.6080506@cn.fujitsu.com \
    --to=gaowanlong@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=weijg.fnst@cn.fujitsu.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.