Thread (40 messages) 40 messages, 5 authors, 2020-03-05

Re: [PATCH v7 1/9] block: Keyslot Manager for Inline Encryption

From: Eric Biggers <ebiggers@kernel.org>
Date: 2020-02-27 18:14:15
Also in: linux-block, linux-f2fs-devel, linux-fscrypt, linux-fsdevel, linux-scsi

On Fri, Feb 21, 2020 at 09:31:18AM -0800, Christoph Hellwig wrote:
On Fri, Feb 21, 2020 at 09:04:34AM -0800, Christoph Hellwig wrote:
quoted
Given that blk_ksm_get_slot_for_key returns a signed keyslot that
can return errors, and the only callers stores it in a signed variable
I think this function should take a signed slot as well, and the check
for a non-negative slot should be moved here from the only caller.
Actually looking over the code again I think it might be better to
return only the error code (and that might actually be a blk_status_t),
and then use an argument to return a pointer to the actual struct
keyslot.  That gives us much easier to understand code and better
type safety.
That doesn't make sense because the caller only cares about the keyslot number,
not the 'struct keyslot'.  The 'struct keyslot' is internal to
keyslot-manager.c, as it only contains keyslot management information.

Your earlier suggestion of making blk_ksm_put_slot() be a no-op on a negative
keyslot number sounds fine though.

- Eric
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help