[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwiHFi1NxC5zD8eY5d9c6LPKCN_K1xa6KO0HEa-NpGMqH2RTQ@mail.gmail.com>
Date: Tue, 9 Jan 2018 00:29:23 +0100
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Yury Norov <ynorov@...iumnetworks.com>
Cc: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Ben Hutchings <ben@...adent.org.uk>,
David Decotigny <decot@...glers.com>,
"David S . Miller" <davem@...emloft.net>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Matthew Wilcox <mawilcox@...rosoft.com>
Subject: Re: [PATCH 1/2] bitmap: new bitmap_copy_safe and bitmap_{from,to}_arr32
On 28 December 2017 at 16:00, Yury Norov <ynorov@...iumnetworks.com> wrote:
>
> In this patch, bitmap_copy_safe and bitmap_{from,to}_arr32 are introduced.
>
> 'Safe' in bitmap_copy_safe() stands for clearing unused bits in bitmap
> beyond last bit till the end of last word. It is useful for hardening
> API when bitmap is assumed to be exposed to userspace.
I agree completely with getting rid of the complexity of the u32array
functions, and also think they should simply be implemented as a
memcpy() when possible.
I'm not a fan of the _safe suffix, though. It doesn't say what it's
safe from. For example, one possible interpretation is that it allows
src or dst to be NULL (becoming a noop in such a case). Why not say
what it does? _clear_tail, _clear_rest, something like that. Or maybe,
can we simply make bitmap_copy behave that way? Hm, probably not, a
bit too many users to check they'd all be ok with that.
Rasmus
Powered by blists - more mailing lists