linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: check return value of asprintf()
@ 2010-10-22 14:32 Namhyung Kim
  2010-10-25  9:30 ` Michal Marek
  0 siblings, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2010-10-22 14:32 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel

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);
 
-- 
1.7.0.4


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

* Re: [PATCH] kbuild: check return value of asprintf()
  2010-10-22 14:32 [PATCH] kbuild: check return value of asprintf() Namhyung Kim
@ 2010-10-25  9:30 ` Michal Marek
  2010-10-25 14:42   ` Randy Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Marek @ 2010-10-25  9:30 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: linux-kbuild, linux-kernel, Randy Dunlap

(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);
>  


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

* Re: [PATCH] kbuild: check return value of asprintf()
  2010-10-25  9:30 ` Michal Marek
@ 2010-10-25 14:42   ` Randy Dunlap
  2010-10-27 22:18     ` Michal Marek
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2010-10-25 14:42 UTC (permalink / raw)
  To: Michal Marek; +Cc: Namhyung Kim, linux-kbuild, linux-kernel

On 10/25/10 02:30, Michal Marek wrote:
> (adding Randy to CC)

Thanks, Michal.

Acked-by: Randy Dunlap <randy.dunlap@oracle.com>


> 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);
>>  
> 


-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

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

* Re: [PATCH] kbuild: check return value of asprintf()
  2010-10-25 14:42   ` Randy Dunlap
@ 2010-10-27 22:18     ` Michal Marek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2010-10-27 22:18 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Namhyung Kim, linux-kbuild, linux-kernel

On 25.10.2010 16:42, Randy Dunlap wrote:
> On 10/25/10 02:30, Michal Marek wrote:
>> (adding Randy to CC)
> 
> Thanks, Michal.
> 
> Acked-by: Randy Dunlap <randy.dunlap@oracle.com>

OK, applied to kbuild-2.6.git#misc.

Michal
> 
> 
>> 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);
>>>  
>>
> 
> 


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

end of thread, other threads:[~2010-10-27 22:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-22 14:32 [PATCH] kbuild: check return value of asprintf() Namhyung Kim
2010-10-25  9:30 ` Michal Marek
2010-10-25 14:42   ` Randy Dunlap
2010-10-27 22:18     ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).