From 9cf87b3f4e9e1305ffc419e8482c35163a7d5d90 Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Thu, 15 Nov 2012 14:56:39 +0100 Subject: [PATCH] Some coverity fixes --- ledmon-0.74-coverity-fixes.patch | 25 +++++++++++++++++++++++++ ledmon.spec | 7 ++++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 ledmon-0.74-coverity-fixes.patch diff --git a/ledmon-0.74-coverity-fixes.patch b/ledmon-0.74-coverity-fixes.patch new file mode 100644 index 0000000..36a580f --- /dev/null +++ b/ledmon-0.74-coverity-fixes.patch @@ -0,0 +1,25 @@ +--- ledmon-0.74/src/scsi.c.orig 2012-08-09 15:57:15.000000000 +0200 ++++ ledmon-0.74/src/scsi.c 2012-11-15 10:12:43.387078547 +0100 +@@ -436,11 +436,11 @@ static void print_page10(struct ses_page + printf("\tDevice type: 0x%01x\n", ((sas[0] & 0x70) >> 4)); + printf("\tSMP Initiator Port: 0x%01x\n", ((sas[2] & 2)>>1)); + printf("\tSTP Initiator Port: 0x%01x\n", ((sas[2] & 4)>>2)); +- printf("\tSSP Initiator Port: 0x%01x\n", ((sas[2] & 8)>>4)); ++ printf("\tSSP Initiator Port: 0x%01x\n", ((sas[2] & 8)>>3)); + printf("\tSATA DEVICE: 0x%01x\n", (sas[3] & 1)); + printf("\tSMP Target Port: 0x%01x\n", ((sas[3] & 2)>>1)); + printf("\tSTP Target Port: 0x%01x\n", ((sas[3] & 4)>>2)); +- printf("\tSSP Target Port: 0x%01x\n", ((sas[3] & 8)>>4)); ++ printf("\tSSP Target Port: 0x%01x\n", ((sas[3] & 8)>>3)); + printf("\tSATA Port Selector: 0x%01x\n", ((sas[3] & 0X80)>>7)); + printf("\tAttached SAS Address: 0x%02x%02x%02x%02x%02x%02x%02x%02x\n", + sas[4], sas[5], sas[6], sas[7], sas[8], sas[9], sas[10], sas[11]); +@@ -597,7 +597,7 @@ static char* get_drive_end_dev(const cha + if (!s) { + return NULL; + } +- p = calloc(s-c, sizeof(*p)); ++ p = calloc(s-c+1, sizeof(*p)); + if (!p) + return NULL; + diff --git a/ledmon.spec b/ledmon.spec index 95396e8..7eb3c78 100644 --- a/ledmon.spec +++ b/ledmon.spec @@ -1,12 +1,13 @@ Summary: Enclosure LED Utilities Name: ledmon Version: 0.74 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Group: Applications/System URL: http://sourceforge.net/projects/ledmon/ Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2 Patch0: ledmon_cflags.patch +Patch1: ledmon-0.74-coverity-fixes.patch BuildRequires: perl BuildRequires: sg3_utils-devel Obsoletes: ledctl = 0.1-1 @@ -23,6 +24,7 @@ use this application. %prep %setup -q %patch0 -p1 -b .cflags +%patch1 -p1 -b .coverity %build # can't use smp_flags because -j4 makes the build fail @@ -38,6 +40,9 @@ make install INSTALL="%{__install} -p" DESTDIR=$RPM_BUILD_ROOT SBIN_DIR=$RPM_BUI %{_mandir}/*/* %changelog +* Thu Nov 15 2012 Jan Synáček - 0.74-3 +- Some coverity fixes + * Fri Oct 19 2012 Jan Synáček - 0.74-2 - Require sg3_utils-libs