rpms/libatasmart/devel libatasmart-uninitialized-var.patch, NONE, 1.1 libatasmart.spec, 1.21, 1.22

Matthias Clasen mclasen at fedoraproject.org
Thu Dec 10 00:43:57 UTC 2009


Author: mclasen

Update of /cvs/pkgs/rpms/libatasmart/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv5778

Modified Files:
	libatasmart.spec 
Added Files:
	libatasmart-uninitialized-var.patch 
Log Message:
Fix an uninitialized variable


libatasmart-uninitialized-var.patch:
 atasmart.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- NEW FILE libatasmart-uninitialized-var.patch ---
>From 26f0cc57fcf346753f17e75fb1378f053dcba92c Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz at redhat.com>
Date: Wed, 9 Dec 2009 17:14:36 -0500
Subject: [PATCH] fix return of uninitialized variable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

 atasmart.c: In function ‘init_smart’:
 atasmart.c:2556: warning: ‘ret’ may be used uninitialized in this function

We apparently don't initialize the ret variable in init_smart() -
unfortunately

 o  this warning is never reported with using -O0 (thanks gcc -
    see http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings though)

 o  we never run into this bug with just skdump(1)

The bug does show up in the udisks (aka DeviceKit-disks) use of
libatasmart and this patch fixes it.

Signed-off-by: David Zeuthen <davidz at redhat.com>
---
 atasmart.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/atasmart.c b/atasmart.c
index 3ff0334..cf93819 100644
--- a/atasmart.c
+++ b/atasmart.c
@@ -2564,6 +2564,8 @@ static int init_smart(SkDisk *d) {
         if (!disk_smart_is_available(d))
                 return 0;
 
+        ret = -1;
+
         if (!disk_smart_is_enabled(d)) {
                 if ((ret = disk_smart_enable(d, TRUE)) < 0)
                         goto fail;
@@ -2580,6 +2582,8 @@ static int init_smart(SkDisk *d) {
 
         disk_smart_read_thresholds(d);
 
+        ret = 0;
+
 fail:
         return ret;
 }
-- 
1.6.5.5



Index: libatasmart.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libatasmart/devel/libatasmart.spec,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -p -r1.21 -r1.22
--- libatasmart.spec	27 Oct 2009 02:35:03 -0000	1.21
+++ libatasmart.spec	10 Dec 2009 00:43:56 -0000	1.22
@@ -1,6 +1,6 @@
 Name: libatasmart
 Version: 0.17
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: ATA S.M.A.R.T. Disk Health Monitoring Library
 Group: System Environment/Libraries
 Source0: http://0pointer.de/public/libatasmart-%{version}.tar.gz
@@ -9,8 +9,11 @@ Url: http://git.0pointer.de/?p=libatasma
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: libudev-devel
 
+# https://bugs.freedesktop.org/show_bug.cgi?id=25543
+Patch0: libatasmart-uninitialized-var.patch
+
 %description
-A small and lightweight parser library for ATA S.M.A.R.T. hard disk
+A scmall and lightweight parser library for ATA S.M.A.R.T. hard disk
 health monitoring.
 
 %package devel
@@ -28,6 +31,7 @@ Development Files for libatasmart Client
 
 %prep
 %setup -q
+%patch0 -p1 -b .uninitialized-var.patch
 
 %build
 %configure --disable-static
@@ -58,6 +62,9 @@ rm -rf $RPM_BUILD_ROOT
 %doc blob-examples/SAMSUNG* blob-examples/ST* blob-examples/Maxtor* blob-examples/WDC* blob-examples/FUJITSU* blob-examples/INTEL* blob-examples/TOSHIBA* blob-examples/MCC*
 
 %changelog
+* Wed Dec  9 2009 Matthias Clasen <mclasen at redhat.com> - 0.17-2
+- Fix an unitialized variable that causes problems in udisks
+
 * Tue Oct 27 2009 Lennart Poettering <lpoetter at redhat.com> 0.17-1
 - New upstream release
 - Fixes bug 491552




More information about the fedora-extras-commits mailing list