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] [day] [month] [year] [list]
Date: Fri, 26 Apr 2024 16:57:47 +0100
From: David Howells <dhowells@...hat.com>
To: Yunsheng Lin <linyunsheng@...wei.com>
Cc: dhowells@...hat.com, davem@...emloft.net, kuba@...nel.org,
    pabeni@...hat.com, netdev@...r.kernel.org,
    linux-kernel@...r.kernel.org,
    Alexander Duyck <alexander.duyck@...il.com>,
    Marc Dionne <marc.dionne@...istor.com>,
    Eric Dumazet <edumazet@...gle.com>, linux-afs@...ts.infradead.org
Subject: Re: [PATCH net] rxrpc: Fix using alignmask being zero for __page_frag_alloc_align()

Yunsheng Lin <linyunsheng@...wei.com> wrote:

> rxrpc_alloc_data_txbuf() may be called with data_align being
> zero in none_alloc_txbuf() and rxkad_alloc_txbuf(), data_align
> is supposed to be an order-based alignment value, but zero is
> not a valid order-based alignment value

Ummm... 0 *would be* a valid order-based[*] alignment (pow(2,0) is 1).  It
might actually make more sense to do that than to pass in the number of bytes,
then 0 is the default, but either way works.

[*] Other places that take an order-based parameter include things like
    alloc_pages().  The number of pages being requested is pow(2,order).

> +	return rxrpc_alloc_data_txbuf(call, min_t(size_t, remain, RXRPC_JUMBO_DATALEN), 1U, gfp);
> +		return rxrpc_alloc_data_txbuf(call, space, 1U, gfp);

The 'U' should be unnecessary.

> +	data_align = max_t(size_t, data_align, L1_CACHE_BYTES);

data_align = umax(data_align, L1_CACHE_BYTES);

would be better, I think.

Anyway, with the umax change above:

Acked-by: David Howells <dhowells@...hat.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ