All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: Namhyung Kim <namhyung@gmail.com>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	Randy Dunlap <randy.dunlap@oracle.com>
Subject: Re: [PATCH] kbuild: check return value of asprintf()
Date: Mon, 25 Oct 2010 11:30:53 +0200	[thread overview]
Message-ID: <4CC54E4D.7040401@suse.cz> (raw)
In-Reply-To: <1287757930-2766-1-git-send-email-namhyung@gmail.com>

(adding Randy to CC)

On 22.10.2010 16:32, Namhyung Kim wrote:
> Check return value of asprintf() in docsect() and exit if error
> occurs. This removes following warning:
> 
>   HOSTCC  scripts/basic/docproc
> scripts/basic/docproc.c: In function ‘docsect’:
> scripts/basic/docproc.c:336: warning: ignoring return value of ‘asprintf’,
> 				declared with attribute warn_unused_result
> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
> The patch is on top of v2.6.36, thanks.
> 
>  scripts/basic/docproc.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c
> index fc3b18d..98dec87 100644
> --- a/scripts/basic/docproc.c
> +++ b/scripts/basic/docproc.c
> @@ -333,7 +333,10 @@ static void docsect(char *filename, char *line)
>  		if (*s == '\n')
>  			*s = '\0';
>  
> -	asprintf(&s, "DOC: %s", line);
> +	if (asprintf(&s, "DOC: %s", line) < 0) {
> +		perror("asprintf");
> +		exit(1);
> +	}
>  	consume_symbol(s);
>  	free(s);
>  


  reply	other threads:[~2010-10-25  9:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-22 14:32 [PATCH] kbuild: check return value of asprintf() Namhyung Kim
2010-10-25  9:30 ` Michal Marek [this message]
2010-10-25 14:42   ` Randy Dunlap
2010-10-27 22:18     ` Michal Marek

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=4CC54E4D.7040401@suse.cz \
    --to=mmarek@suse.cz \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@gmail.com \
    --cc=randy.dunlap@oracle.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.