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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120614072831.63845f6ddf024ece28e49f5e@gmail.com>
Date:	Thu, 14 Jun 2012 07:28:31 +0900
From:	Takuya Yoshikawa <takuya.yoshikawa@...il.com>
To:	Grant Grundler <grantgrundler@...il.com>
Cc:	Akinobu Mita <akinobu.mita@...il.com>,
	Takuya Yoshikawa <yoshikawa.takuya@....ntt.co.jp>,
	akpm@...ux-foundation.org, bhutchings@...arflare.com,
	grundler@...isc-linux.org, arnd@...db.de, benh@...nel.crashing.org,
	avi@...hat.com, mtosatti@...hat.com,
	linux-net-drivers@...arflare.com, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
	kvm@...r.kernel.org
Subject: Re: [PATCH 2/5] drivers/net/ethernet/dec/tulip: Use standard
 __set_bit_le() function

On Wed, 13 Jun 2012 08:21:18 -0700
Grant Grundler <grantgrundler@...il.com> wrote:

> >> >> Should this hash_table be converted from u16 hash_table[32] to
> >> >> DECLARE_BITMAP(hash_table, 16 * 32) to ensure that it is aligned
> >> >> on long-word boundary?
> >> >
> >> > I think hash_table is already long-word aligned because it is placed
> >> > right after a pointer.
> >>
> >> I recommend converting to proper bitmap.  Because such an implicit
> >> assumption is easily broken by someone touching this function.
> >
> > Do you mean something like:
> >        DECLARE_BITMAP(__hash_table, 16 * 32);
> >        u16 *hash_table = (u16 *)__hash_table;
> > ?
> >
> > Grant, what do you think about this?
> 
> Hi Takuya,
> two thoughts:
> 1) while I agree with Akinobu and thank him for pointing out a
> _potential_ alignment problem, this is a separate issue and your
> existing patch should go in anyway. There are probably other drivers
> with _potential_ alignment issues. Akinobu could get credit for
> finding them by submitting patches after reviewing calls to set_bit
> and set_bit_le() - similar to what you are doing now.

I prefer approach 1.

hash_table is local in build_setup_frame_hash(), so if further
improvement is also required, we can do that locally there later.

Thanks,
	Takuya


> 2) I generally do not like declaring one type and then using an alias
> of a different type to reference the same memory address. We have a
> simple alternative since hash_table[] is indexed directly only in one
> hunk of code:
>         for (i = 0; i < 32; i++) {
>                 *setup_frm++ = ((u16 *)hash_table)[i];
>                 *setup_frm++ = ((u16 *)hash_table)[i];
>         }
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ