lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 14 Oct 2007 19:50:32 +0200
From:	Adrian Bunk <bunk@...nel.org>
To:	Ivo van Doorn <IvDoorn@...il.com>,
	"John W. Linville" <linville@...driver.com>
Cc:	linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: drivers/net/wireless/rt2x00/: struct data_desc strangeness

drivers/net/wireless/rt2x00/rt2x00ring.h contains the following:

<--  snip  -->

...
/*
 * data_desc
 * Each data entry also contains a descriptor which is used by the
 * device to determine what should be done with the packet and
 * what the current status is.
 * This structure is greatly simplified, but the descriptors
 * are basically a list of little endian 32 bit values.
 * Make the array by default 1 word big, this will allow us
 * to use sizeof() correctly.
 */
struct data_desc {
        __le32 word[1];
};
...
/*
 * TX/RX Descriptor access functions.
 */
static inline void rt2x00_desc_read(struct data_desc *desc,
                                    const u8 word, u32 *value)
{
        *value = le32_to_cpu(desc->word[word]);
}

static inline void rt2x00_desc_write(struct data_desc *desc,
                                     const u8 word, const u32 value)
{
        desc->word[word] = cpu_to_le32(value);
}
...

<--  snip  -->

I haven't checked whether it might work in all cases, but passing 
non-zero values as second parameter to rt2x00_desc_{read,write}()
(as is done in many cases) is even in the best case bad coding style.

Spotted by the Coverity checker.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ