Re: [PATCH 1/2] ecryptfs: Improve metatdata read failure logging

From: Kees Cook
Date: Wed Jan 11 2012 - 15:36:53 EST


On Wed, Jan 11, 2012 at 06:00:41PM +0100, Tim Gardner wrote:
> There are 3 read failure cases in ecryptfs_read_metadata(), but only 2
> of them are uniquely noted by kernel log messages. This patch
> identifies and logs each read failure case. It also correctly interprets
> a negative return value from ecryptfs_read_lower().
>
> Removes unnecessary variable initialization.
>
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: stable@xxxxxxxxxxxxxxx
> Cc: Tyler Hicks <tyler.hicks@xxxxxxxxxxxxx>
> Signed-off-by: Tim Gardner <tim.gardner@xxxxxxxxxxxxx>

I always like more verbose error reporting. :)

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

> + printk(KERN_ERR "%s: Could not read %u bytes\n",
> + __func__, crypt_stat->extent_size);

I wonder if eCryptfs in general might want to consider using the "pr_fmt"
and "pr_*" macros to do printk handling:

#define pr_fmt(fmt) __func__ ": " fmt

...

pr_err("Could not read %u bytes\n", crypt_stat->extent_size);


-Kees

--
Kees Cook
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/