Re: [PATCH 18/27] afs: Detect cell aliases 1 - Cells with root volumes
From: Kees Cook
Date: Fri Jun 05 2020 - 21:59:08 EST
On Fri, May 29, 2020 at 11:02:15PM +0100, David Howells wrote:
> +static struct afs_volume *afs_sample_volume(struct afs_cell *cell, struct key *key,
> + const char *name, unsigned int namelen)
> +{
> + struct afs_volume *volume;
> + struct afs_fs_context fc = {
> + .type = 0, /* Explicitly leave it to the VLDB */
> + .volnamesz = namelen,
> + .volname = name,
> + .net = cell->net,
> + .cell = cell,
> + .key = key, /* This might need to be something */
> + };
> +
> + volume = afs_create_volume(&fc);
> + _leave(" = %px", volume);
> + return volume;
> +}
This really doesn't seem like a justified[1] place for %px. (Even if
_leavel() is debug-only, all the rest of _leave() uses are %p.)
> + default:
> + BUG();
And nothing should add BUG() to new code[2].
-Kees
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#p-format-specifier
[2] https://www.kernel.org/doc/html/latest/process/deprecated.html#bug-and-bug-on
--
Kees Cook