[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <de9c1287-9be0-40bf-8dbd-717c56ea0d7e@rivosinc.com>
Date: Fri, 24 Nov 2023 11:46:42 +0100
From: Clément Léger <cleger@...osinc.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: Ben Dooks <ben.dooks@...ethink.co.uk>,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu
Subject: Re: [PATCH] riscv: fix __user annotation in traps_misaligned.c
On 24/11/2023 11:45, Christoph Hellwig wrote:
> On Fri, Nov 24, 2023 at 11:28:08AM +0100, Clément Léger wrote:
>> I sent a similar patch two days ago with the same modification. I'm not
>> sure to get it. Why is it better to pass the "unsigned long" type from
>> the caller ? I mean, the resulting code would look like this right ?
>
> Because you're legimitizing casting between address_space, which is a
> horrible idea. By casting either from the unsigned long you make it
> very clear that deep magic is coming in and you make an informed
> decisions based on the user_mode() predicate. Witht a blind cast
> to add/remove a __user you don't.
Makes sense indeed, thanks !
Clément
>
> I'm actually surprised sparse even allows __user casts without __force.
Powered by blists - more mailing lists