Some coverity fixes

This commit is contained in:
Jan Synacek 2012-11-15 14:56:39 +01:00
parent d79135fbad
commit 9cf87b3f4e
2 changed files with 31 additions and 1 deletions

View File

@ -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;

View File

@ -1,12 +1,13 @@
Summary: Enclosure LED Utilities Summary: Enclosure LED Utilities
Name: ledmon Name: ledmon
Version: 0.74 Version: 0.74
Release: 2%{?dist} Release: 3%{?dist}
License: GPLv2+ License: GPLv2+
Group: Applications/System Group: Applications/System
URL: http://sourceforge.net/projects/ledmon/ URL: http://sourceforge.net/projects/ledmon/
Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2 Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
Patch0: ledmon_cflags.patch Patch0: ledmon_cflags.patch
Patch1: ledmon-0.74-coverity-fixes.patch
BuildRequires: perl BuildRequires: perl
BuildRequires: sg3_utils-devel BuildRequires: sg3_utils-devel
Obsoletes: ledctl = 0.1-1 Obsoletes: ledctl = 0.1-1
@ -23,6 +24,7 @@ use this application.
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .cflags %patch0 -p1 -b .cflags
%patch1 -p1 -b .coverity
%build %build
# can't use smp_flags because -j4 makes the build fail # 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}/*/* %{_mandir}/*/*
%changelog %changelog
* Thu Nov 15 2012 Jan Synáček <jsynacek@redhat.com> - 0.74-3
- Some coverity fixes
* Fri Oct 19 2012 Jan Synáček <jsynacek@redhat.com> - 0.74-2 * Fri Oct 19 2012 Jan Synáček <jsynacek@redhat.com> - 0.74-2
- Require sg3_utils-libs - Require sg3_utils-libs