All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] diskfilter: Treat an unrecognized RAID level as an error
@ 2012-02-04 22:01 Richard Laager
  2012-02-04 22:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Laager @ 2012-02-04 22:01 UTC (permalink / raw)
  To: grub-devel


[-- Attachment #1.1: Type: text/plain, Size: 253 bytes --]

disk/diskfilter.c: In function 'grub_diskfilter_make_raid':
disk/diskfilter.c:847:21: error: 'totsize' may be used uninitialized in
this function [-Werror=uninitialized]

Perhaps my patch should use assert() instead of return NULL?

-- 
Richard

[-- Attachment #1.2: Type: text/x-patch, Size: 860 bytes --]

diskfilter: Treat an unrecognized RAID level as an error

disk/diskfilter.c: In function 'grub_diskfilter_make_raid':
disk/diskfilter.c:847:21: error: 'totsize' may be used uninitialized in this function [-Werror=uninitialized]

Perhaps this should be an assert() instead of return NULL?

=== modified file 'grub-core/disk/diskfilter.c'
Index: grub/grub-core/disk/diskfilter.c
===================================================================
--- grub.orig/grub-core/disk/diskfilter.c	2012-02-04 15:42:05.511916000 -0600
+++ grub/grub-core/disk/diskfilter.c	2012-02-04 15:50:17.059270000 -0600
@@ -837,6 +837,9 @@ grub_diskfilter_make_raid (grub_size_t u
     case 6:
       totsize = (nmemb - level / 3) * disk_size;
       break;
+
+    default:
+      return NULL;
     }
 
   array = grub_diskfilter_get_vg_by_uuid (uuidlen, uuid);

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] diskfilter: Treat an unrecognized RAID level as an error
  2012-02-04 22:01 [PATCH] diskfilter: Treat an unrecognized RAID level as an error Richard Laager
@ 2012-02-04 22:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2012-02-04 23:00   ` Richard Laager
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2012-02-04 22:30 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Richard Laager

On 04.02.2012 23:01, Richard Laager wrote:
> disk/diskfilter.c: In function 'grub_diskfilter_make_raid':
> disk/diskfilter.c:847:21: error: 'totsize' may be used uninitialized in
> this function [-Werror=uninitialized]
>
> Perhaps my patch should use assert() instead of return NULL?
We don't use assert since assert failures are usually not fatal. And 
failing to boot just because some otherwise unused disk has a RAID-9 
isn't reasonable.
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



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

* Re: [PATCH] diskfilter: Treat an unrecognized RAID level as an error
  2012-02-04 22:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2012-02-04 23:00   ` Richard Laager
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Laager @ 2012-02-04 23:00 UTC (permalink / raw)
  To: Vladimir 'φ-coder/phcoder' Serbinenko
  Cc: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 758 bytes --]

On Sat, 2012-02-04 at 23:30 +0100, Vladimir 'φ-coder/phcoder' Serbinenko
wrote:
> On 04.02.2012 23:01, Richard Laager wrote:
> > disk/diskfilter.c: In function 'grub_diskfilter_make_raid':
> > disk/diskfilter.c:847:21: error: 'totsize' may be used uninitialized in
> > this function [-Werror=uninitialized]
> >
> > Perhaps my patch should use assert() instead of return NULL?
> We don't use assert since assert failures are usually not fatal. And 
> failing to boot just because some otherwise unused disk has a RAID-9 
> isn't reasonable.

Noted. I see now that Grégoire Sutre already submitted the same fix. I
don't know how I missed that mail before. Sorry for the noise. At least
I learned about GRUB's take on assert().

-- 
Richard

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2012-02-04 23:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-04 22:01 [PATCH] diskfilter: Treat an unrecognized RAID level as an error Richard Laager
2012-02-04 22:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-04 23:00   ` Richard Laager

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.