Bug 79638 - bad source code
Summary: bad source code
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: hdparm
Version: 8.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Karsten Hopp
QA Contact: Jay Turner
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-12-14 10:36 UTC by d.binderman
Modified: 2015-01-08 00:02 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2003-06-04 10:52:19 UTC


Attachments (Terms of Use)

Description d.binderman 2002-12-14 10:36:35 UTC
Description of problem:

Hello there,

I just tried to compile package hdparm-5.2-1 from Redhat 8.0.

Here are some of the compiler messages.

hdparm.c: In function `identify_from_stdin':
hdparm.c:1486: warning: operation on `b' may be undefined
hdparm.c:1486: warning: operation on `b' may be undefined
hdparm.c:1486: warning: operation on `b' may be undefined

Here is an untested patch which shuts up the compiler.

*** ./hdparm.c.old	2002-11-27 09:55:30.000000000 +0000
--- ./hdparm.c	2002-11-27 09:56:52.000000000 +0000
***************
*** 1483,1490 ****
  		exit(errno);
  	}
  	for (i = 0; count >= 4; ++i) {
! 		*w++ = (fromhex(*b++)<<12) | (fromhex(*b++)<<8) | (fromhex(*b++)<<4) | (fromhex(*b++));
! 		++b;
  		count -= 5;
  	}
  	identify((void *)buf, NULL);
--- 1483,1493 ----
  		exit(errno);
  	}
  	for (i = 0; count >= 4; ++i) {
! 		*w++ = (fromhex( b[ 0]) << 12) 
! 			| (fromhex( b[ 1]) << 8) 
! 			| (fromhex( b[ 2]) << 4) 
! 			| (fromhex( b[ 3]));
! 		b += 5;
  		count -= 5;
  	}
  	identify((void *)buf, NULL);


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
    
Actual results:


Expected results:


Additional info:

Comment 1 Karsten Hopp 2003-06-04 10:52:19 UTC
seems to be fixed in hdparm-5.4 


Note You need to log in before you can comment on or make changes to this bug.