public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Geoff Levand <geoff@infradead.org>
Cc: kexec@lists.infradead.org
Subject: Re: [PATCH 5/6] kexec: Fix return value build warnings
Date: Thu, 3 Oct 2013 10:06:01 +0900	[thread overview]
Message-ID: <20131003010600.GC13111@verge.net.au> (raw)
In-Reply-To: <46065cda6087e6c9699f2e06f00d914235740c6c.1380746425.git.geoff@infradead.org>

On Wed, Oct 02, 2013 at 08:49:46PM +0000, Geoff Levand wrote:
> Add a local variable and check return values.

The patch seems to do a bit more than that.
Could you either split the patch up or enhance the changelog?

> 
> Fixes build warnings like these:
> 
>   kexec/fs2dt.c: warning: ignoring return value of ‘read’
> 
> Signed-off-by: Geoff Levand <geoff@infradead.org> for Huawei, Linaro
> ---
>  kexec/fs2dt.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/kexec/fs2dt.c b/kexec/fs2dt.c
> index 1f5b0cf..50e173e 100644
> --- a/kexec/fs2dt.c
> +++ b/kexec/fs2dt.c
> @@ -555,6 +555,7 @@ static void putnode(void)
>  	/* Add cmdline to the second kernel.  Check to see if the new
>  	 * cmdline has a root=.  If not, use the old root= cmdline.  */
>  	if (!strcmp(basename,"chosen/")) {
> +		size_t result;
>  		size_t cmd_len = 0;
>  		char *param = NULL;
>  		char filename[MAXPATH];
> @@ -636,8 +637,13 @@ static void putnode(void)
>  			close(fd);
>  			goto no_debug;
>  		}
> -		read(fd, buff, statbuf.st_size);
> +		result = read(fd, buff, statbuf.st_size);
>  		close(fd);
> +		if (result <= 0) {
> +			printf("Unable to stat %s, printing from purgatory is diabled\n",


It seems to me this should be "Unable to read..."

> +														filename);
> +			goto no_debug;
> +		}
>  		strncpy(filename, "/proc/device-tree/", MAXPATH);
>  		strncat(filename, buff, MAXPATH);
>  		strncat(filename, "/compatible", MAXPATH);
> @@ -659,8 +665,8 @@ static void putnode(void)
>  			close(fd);
>  			goto no_debug;
>  		}
> -		read(fd, buff, statbuf.st_size);
> -		if (!strcmp(buff, "hvterm1") || !strcmp(buff, "hvterm-protocol"))
> +		result = read(fd, buff, statbuf.st_size);
> +		if (result && (!strcmp(buff, "hvterm1") || !strcmp(buff, "hvterm-protocol")))
>  			my_debug = 1;
>  		close(fd);
>  		free(buff);
> -- 
> 1.8.1.2
> 
> 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2013-10-03  1:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-02 20:54 [PATCH 0/6] kexec-tools fixes Geoff Levand
2013-10-02 20:49 ` [PATCH 5/6] kexec: Fix return value build warnings Geoff Levand
2013-10-03  1:06   ` Simon Horman [this message]
2013-10-03 20:19   ` [PATCH 0/2] V2 " Geoff Levand
2013-10-03 20:19     ` [PATCH 2/2] kexec: Handle read errors in fs2dt setup Geoff Levand
2013-10-04  0:02       ` Simon Horman
2013-10-03 20:19     ` [PATCH 1/2] kexec: Fix return value build warnings Geoff Levand
2013-10-04  0:02       ` Simon Horman
2013-10-02 20:49 ` [PATCH 3/6] purgatory: Fix out-of-source build error Geoff Levand
2013-10-02 20:49 ` [PATCH 2/6] kexec: Remove unused -? option handling Geoff Levand
2013-10-02 20:49 ` [PATCH 4/6] kexec: Fix uninitialized build warning Geoff Levand
2013-10-02 20:49 ` [PATCH 1/6] kexec: Fix the -? option Geoff Levand
2013-10-02 20:49 ` [PATCH 6/6] config: Update to automake-1.11 Geoff Levand
2013-10-03  1:07 ` [PATCH 0/6] kexec-tools fixes Simon Horman

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=20131003010600.GC13111@verge.net.au \
    --to=horms@verge.net.au \
    --cc=geoff@infradead.org \
    --cc=kexec@lists.infradead.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