+ watchdog-itco_wdt-fix-bug-related-to-gcc-uninit-warning.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     watchdog/iTCO_wdt: fix bug related to gcc uninit warning

has been added to the -mm tree.  Its filename is

     watchdog-itco_wdt-fix-bug-related-to-gcc-uninit-warning.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: watchdog/iTCO_wdt: fix bug related to gcc uninit warning
From: Jeff Garzik <jeff@xxxxxxxxxx>

gcc emits the following warning:

drivers/char/watchdog/iTCO_wdt.c: In function â??iTCO_wdt_ioctlâ??:
drivers/char/watchdog/iTCO_wdt.c:429: warning: â??time_leftâ?? may be used uninitialized in this function

This indicates a condition near enough to a bug, to want to fix.
iTCO_wdt_get_timeleft() stores a value in 'time_left' iff
iTCO_version==(1 or 2).  This driver only supports versions
1 or 2, so this is ok.  However, since (a) the return value of
iTCO_wdt_get_timeleft() is handled anyway, (b) it fixes the warning,
and (c) it future-proofs the driver, we go ahead and add the obvious
return value.

Signed-off-by: Jeff Garzik <jeff@xxxxxxxxxx>
Cc: Wim Van Sebroeck <wim@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/char/watchdog/iTCO_wdt.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -puN drivers/char/watchdog/iTCO_wdt.c~watchdog-itco_wdt-fix-bug-related-to-gcc-uninit-warning drivers/char/watchdog/iTCO_wdt.c
--- a/drivers/char/watchdog/iTCO_wdt.c~watchdog-itco_wdt-fix-bug-related-to-gcc-uninit-warning
+++ a/drivers/char/watchdog/iTCO_wdt.c
@@ -368,7 +368,8 @@ static int iTCO_wdt_get_timeleft (int *t
 		spin_unlock(&iTCO_wdt_private.io_lock);
 
 		*time_left = (val8 * 6) / 10;
-	}
+	} else
+		return -EINVAL;
 	return 0;
 }
 
@@ -439,7 +440,6 @@ static int iTCO_wdt_ioctl (struct inode 
 {
 	int new_options, retval = -EINVAL;
 	int new_heartbeat;
-	int time_left;
 	void __user *argp = (void __user *)arg;
 	int __user *p = argp;
 	static struct watchdog_info ident = {
@@ -499,6 +499,8 @@ static int iTCO_wdt_ioctl (struct inode 
 
 		case WDIOC_GETTIMELEFT:
 		{
+			int time_left;
+
 			if (iTCO_wdt_get_timeleft(&time_left))
 				return -EINVAL;
 
_

Patches currently in -mm which might be from jeff@xxxxxxxxxx are

origin.patch
fix-up-a-multitude-of-acpi-compiler-warnings-on-x86_64.patch
fs-partitions-check-add-sysfs-error-handling.patch
drm-fix-error-returns-sysfs-error-handling.patch
git-libata-all.patch
ata-must-depend-on-block.patch
pci_module_init-conversion-for-pata_pdc2027x.patch
libata-return-sense-data-in-hdio_drive_cmd-ioctl.patch
libata-return-sense-data-in-hdio_drive_cmd-ioctl-tidy.patch
via-pata-controller-xfer-fixes.patch
ahci-ati-sb600-sata-support-for-various-modes.patch
git-mtd.patch
git-netdev-all.patch
libphy-dont-do-that.patch
update-smc91x-driver-with-arm-versatile-board-info.patch
b44-fix-eeprom-endianess-issue.patch
forcedeth-power-management-support.patch
forcedeth-power-management-support-tidy.patch
remove-unnecessary-check-in-drivers-net-depcac.patch
8139too-force-media-setting-fix.patch
ibmveth-irq-fix.patch
tulip-fix-shutdown-dma-irq-race.patch
r8169-driver-corega-support-patch.patch
git-pciseg.patch
airo-suspend-fix.patch
tpm-fix-error-handling.patch
x86-microcode-handle-sysfs-error.patch
git-gccbug.patch
input-handle-sysfs-errors.patch
firmware-dell_rbu-handle-sysfs-errors.patch
firmware-dcdbas-fix-bug-in-error-cleanup.patch
drivers-dma-handle-sysfs-errors.patch
cpufreq-handle-sysfs-errors.patch
ipmi-handle-sysfs-errors.patch
atm-firestream-handle-thrown-error.patch
watchdog-itco_wdt-fix-bug-related-to-gcc-uninit-warning.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux