Bug 191380 - ext2fs_find_first_bit_set has bad typecast
Summary: ext2fs_find_first_bit_set has bad typecast
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: e2fsprogs
Version: 4.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Thomas Woerner
QA Contact: Jay Turner
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-05-11 14:20 UTC by Kimball Murray
Modified: 2015-01-08 00:12 UTC (History)
2 users (show)

Fixed In Version: RHBA-2007-0255
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-05-01 23:52:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2007:0255 0 normal SHIPPED_LIVE e2fsprogs bug fix update 2007-04-28 17:45:33 UTC

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



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