Bug 191380 - ext2fs_find_first_bit_set has bad typecast
ext2fs_find_first_bit_set has bad typecast
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: e2fsprogs (Show other bugs)
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Thomas Woerner
Jay Turner
Depends On:
  Show dependency treegraph
Reported: 2006-05-11 10:20 EDT by Kimball Murray
Modified: 2015-01-07 19:12 EST (History)
2 users (show)

See Also:
Fixed In Version: RHBA-2007-0255
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-05-01 19:52:53 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Kimball Murray 2006-05-11 10:20:23 EDT
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):

How reproducible:

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

Expected results:
compile success.

Additional info:
Comment 1 RHEL Product and Program Management 2006-08-18 11:55:14 EDT
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
Comment 2 Thomas Woerner 2007-01-25 03:04:42 EST
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 19:52:53 EDT
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.


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