Linux ATA/IDE development
 help / color / mirror / Atom feed
* [PATCH] libata: Shut up annoying native_sectors warning
@ 2012-12-20 12:25 Borislav Petkov
  2012-12-20 13:01 ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2012-12-20 12:25 UTC (permalink / raw)
  To: LKML; +Cc: Borislav Petkov, Jeff Garzik, linux-ide

I'm getting this

drivers/ata/libata-core.c: In function ‘ata_hpa_resize’:
drivers/ata/libata-core.c:1397:3: warning: ‘native_sectors’ may be used uninitialized in this function [-Wmaybe-uninitialized]

for a couple of kernel releases now with gcc (Debian 4.7.2-4) 4.7.2.

And the warning is bogus because ata_read_native_max_address either
returns a sensible max_sectors aka native_sectors through its second
arg pointer or an error value which is properly handled in its caller
ata_hpa_resize().

So shut up gcc already.

Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-ide@vger.kernel.org
Signed-off-by: Borislav Petkov <bp@alien8.de>
---
 drivers/ata/libata-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9e8b99af400d..3860f6be8c19 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1324,7 +1324,7 @@ static int ata_hpa_resize(struct ata_device *dev)
 	int print_info = ehc->i.flags & ATA_EHI_PRINTINFO;
 	bool unlock_hpa = ata_ignore_hpa || dev->flags & ATA_DFLAG_UNLOCK_HPA;
 	u64 sectors = ata_id_n_sectors(dev->id);
-	u64 native_sectors;
+	u64 native_sectors = 0;
 	int rc;
 
 	/* do we need to do it? */
-- 
1.8.1.rc2


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

* Re: [PATCH] libata: Shut up annoying native_sectors warning
  2012-12-20 12:25 [PATCH] libata: Shut up annoying native_sectors warning Borislav Petkov
@ 2012-12-20 13:01 ` Alan Cox
  2012-12-20 15:04   ` Borislav Petkov
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2012-12-20 13:01 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: LKML, Jeff Garzik, linux-ide

On Thu, 20 Dec 2012 13:25:55 +0100
Borislav Petkov <bp@alien8.de> wrote:

> I'm getting this
> 
> drivers/ata/libata-core.c: In function ‘ata_hpa_resize’:
> drivers/ata/libata-core.c:1397:3: warning: ‘native_sectors’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> for a couple of kernel releases now with gcc (Debian 4.7.2-4) 4.7.2.
> 
> And the warning is bogus because ata_read_native_max_address either
> returns a sensible max_sectors aka native_sectors through its second
> arg pointer or an error value which is properly handled in its caller
> ata_hpa_resize().
> 
> So shut up gcc already.

And ensure it won't be noticed if a real problem is found. So we go from
warning for a few people who ignore it, to silence for everyone if a real
bug appears

Net lose IMHO - better to file a gcc bug report

Alan


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

* Re: [PATCH] libata: Shut up annoying native_sectors warning
  2012-12-20 13:01 ` Alan Cox
@ 2012-12-20 15:04   ` Borislav Petkov
  2012-12-20 15:37     ` Borislav Petkov
  0 siblings, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2012-12-20 15:04 UTC (permalink / raw)
  To: Alan Cox; +Cc: LKML, Jeff Garzik, linux-ide

On Thu, Dec 20, 2012 at 01:01:59PM +0000, Alan Cox wrote:
> Net lose IMHO - better to file a gcc bug report

Ok, I'll try that. Want on CC?

The good thing is, it is a new issue in 4.7 since it doesn't trigger
with 4.6:

$  make CC=gcc-4.6 drivers/ata/libata-core.o
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `relocs'.
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CC      drivers/ata/libata-core.o

vs

$  make CC=gcc-4.7 drivers/ata/libata-core.o
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `relocs'.
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/x86/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/empty.o
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CC      drivers/ata/libata-core.o
drivers/ata/libata-core.c: In function ‘ata_hpa_resize’:
drivers/ata/libata-core.c:1397:3: warning: ‘native_sectors’ may be used uninitialized in this function [-Wmaybe-uninitialized]

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

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

* Re: [PATCH] libata: Shut up annoying native_sectors warning
  2012-12-20 15:04   ` Borislav Petkov
@ 2012-12-20 15:37     ` Borislav Petkov
  0 siblings, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2012-12-20 15:37 UTC (permalink / raw)
  To: Alan Cox, LKML, Jeff Garzik, linux-ide

On Thu, Dec 20, 2012 at 04:04:23PM +0100, Borislav Petkov wrote:
> On Thu, Dec 20, 2012 at 01:01:59PM +0000, Alan Cox wrote:
> > Net lose IMHO - better to file a gcc bug report
> Ok, I'll try that. Want on CC?

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55759

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

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

end of thread, other threads:[~2012-12-20 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20 12:25 [PATCH] libata: Shut up annoying native_sectors warning Borislav Petkov
2012-12-20 13:01 ` Alan Cox
2012-12-20 15:04   ` Borislav Petkov
2012-12-20 15:37     ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox