Bug 191380

Summary: ext2fs_find_first_bit_set has bad typecast
Product: Red Hat Enterprise Linux 4 Reporter: Kimball Murray <kmurray>
Component: e2fsprogsAssignee: Thomas Woerner <twoerner>
Status: CLOSED ERRATA QA Contact: Jay Turner <jturner>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: sct, srevivo
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0255 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-05-01 23:52:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kimball Murray 2006-05-11 14:20:23 UTC
Description of problem:
Stratus wrote a disk test utility in C++ that includes
/usr/include/ext2fs/bitops.h.  That file has a function called
ext2fs_find_first_bit_set (line 438) with a bad typecast.  The utility fails to
compile with the following error:

g++ src/disk_test.cc  -o progs/disk_test_64 -lext2fs

In file included from /usr/include/ext2fs/ext2fs.h:250,

                 from src/disk_test.h:15,

                 from src/disk_test.cc:40:

/usr/include/ext2fs/bitops.h: In function `int ext2fs_find_first_bit_set(void*,
unsigned int)':

/usr/include/ext2fs/bitops.h:440: error: invalid conversion from `unsigned char*'
to `char*'

make: *** [test1] Error 1

The offending code looks like this (from bitops.h)

_INLINE_ int ext2fs_find_first_bit_set(void * addr, unsigned size)
{
        char    *cp = (unsigned char *) addr;

Stratus has verified that cp can be declared as an unsigned char and it all just
works fine after that.

Version-Release number of selected component (if applicable):
e2fsprogs-devel-1.35-12.2.EL4

How reproducible:
100%

Steps to Reproduce:
1. compile disk utility that includes bitops.h
2.
3.
  
Actual results:
compile error.

Expected results:
compile success.

Additional info:

Comment 1 RHEL Program Management 2006-08-18 15:55:14 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 2 Thomas Woerner 2007-01-25 08:04:42 UTC
Can it be that this utility is using the ext2fs_find_first_bit_set without
setting the type to (void *) for the first argument?

Comment 6 Red Hat Bugzilla 2007-05-01 23:52:53 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0255.html