All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix an uninitialized variable.
@ 2020-01-27 20:01 Peter Jones
  2020-01-29 12:25 ` Daniel Kiper
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Jones @ 2020-01-27 20:01 UTC (permalink / raw)
  To: grub-devel; +Cc: Daniel Kiper, Peter Jones

gcc says:

grub-core/fs/squash4.c: In function ‘direct_read’:
grub-core/fs/squash4.c:868:10: error: ‘err’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
  868 |       if (err)
      |          ^
cc1: all warnings being treated as errors

This patch initializes it to 0.

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 grub-core/fs/squash4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c
index 95d5c1e1ff4..0583aeab8e8 100644
--- a/grub-core/fs/squash4.c
+++ b/grub-core/fs/squash4.c
@@ -746,7 +746,7 @@ direct_read (struct grub_squash_data *data,
 	     struct grub_squash_cache_inode *ino,
 	     grub_off_t off, char *buf, grub_size_t len)
 {
-  grub_err_t err;
+  grub_err_t err = 0;
   grub_off_t cumulated_uncompressed_size = 0;
   grub_uint64_t a = 0;
   grub_size_t i;
-- 
2.24.1



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

* Re: [PATCH] Fix an uninitialized variable.
  2020-01-27 20:01 [PATCH] Fix an uninitialized variable Peter Jones
@ 2020-01-29 12:25 ` Daniel Kiper
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Kiper @ 2020-01-29 12:25 UTC (permalink / raw)
  To: Peter Jones; +Cc: grub-devel, Daniel Kiper

On Mon, Jan 27, 2020 at 03:01:16PM -0500, Peter Jones wrote:
> gcc says:
>
> grub-core/fs/squash4.c: In function ‘direct_read’:
> grub-core/fs/squash4.c:868:10: error: ‘err’ may be used uninitialized in
> this function [-Werror=maybe-uninitialized]
>   868 |       if (err)
>       |          ^
> cc1: all warnings being treated as errors
>
> This patch initializes it to 0.
>
> Signed-off-by: Peter Jones <pjones@redhat.com>

Pushed but with small change...

> ---
>  grub-core/fs/squash4.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c
> index 95d5c1e1ff4..0583aeab8e8 100644
> --- a/grub-core/fs/squash4.c
> +++ b/grub-core/fs/squash4.c
> @@ -746,7 +746,7 @@ direct_read (struct grub_squash_data *data,
>  	     struct grub_squash_cache_inode *ino,
>  	     grub_off_t off, char *buf, grub_size_t len)
>  {
> -  grub_err_t err;
> +  grub_err_t err = 0;

s/0/GRUB_ERR_NONE/

Thanks,

Daniel


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

end of thread, other threads:[~2020-01-29 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-27 20:01 [PATCH] Fix an uninitialized variable Peter Jones
2020-01-29 12:25 ` Daniel Kiper

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.