Re: [PATCH] ext3: Fix sparse -Wbitwise warnings.

From: Stephen C. Tweedie (sct_at_redhat.com)
Date: 02/15/05

  • Next message: Vojtech Pavlik: "Re: PATCH 2.6.11-rc4]: IBM TrackPoint configuration support"
    To: Alexey Dobriyan <adobriyan@mail.ru>
    Date:	Tue, 15 Feb 2005 14:12:09 +0000
    
    

    Hi,

    On Tue, 2005-02-15 at 10:46, Alexey Dobriyan wrote:

    > - if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb,
    > - ~EXT3_FEATURE_RO_COMPAT_SUPP))) {
    > + if ((ret = le32_to_cpu(EXT3_HAS_RO_COMPAT_FEATURE(sb,
    > + ~EXT3_FEATURE_RO_COMPAT_SUPP)))) {

    NAK.

    EXT3_HAS_RO_COMPAT_FEATURE returns a boolean value. It happens to be
    implemented internally as

    #define EXT3_HAS_COMPAT_FEATURE(sb,mask) \
            ( EXT3_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )

    so the compiler, looking at the preprocessed code, will reasonably
    assume it's a genuine little-endian value. But it's only used as a
    boolean, so we shouldn't be requiring the callers to provide an
    le32_to_cpu() conversion.

    If we want to fix this, let's fix the macros: for example, convert
    EXT3_HAS_COMPAT_FEATURE to be

            ( le32_to_cpu(EXT3_SB(sb)->s_es->s_feature_compat) & (mask) )

    so that we're doing the tests in native CPU endian-ness.

    --Stephen

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Vojtech Pavlik: "Re: PATCH 2.6.11-rc4]: IBM TrackPoint configuration support"

    Relevant Pages

    • Re: Power Management Update
      ... I encountered this problem by having an IDE CD-ROM, ... He mentioned producing a cleaner patch, but this should at least fix the ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Testing RC kernels [KORG]
      ... Can someone with access to the html for kernel.org please fix that? ... We've had several messages now complaining about this. ... Copyright 2005 by Maurice Eugene Heskett, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.4.22-rc2 ext2 filesystem corruption
      ... > # Without this fix it mistakenly assumes that the empty drive slot ... the 64K cylinders problem) I know I saw transfer speeds greater than ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] fs/fcntl.c : dont test unsigned value for less than zero
      ... I think the real problem here is that 'arg' ... architecture's ptrace code could easily make use of the latter, ... But be careful not to "fix up" ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.4.23aa2 (bugfixes and important VM improvements for the high end)
      ... That may well fix all problems 2.6 would have otherwise had ... > from the tail of the LRU which were moved there at interrupt time. ... Forget about me proposing the OVM stuff;) ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)