Re: [PATCH] lkdtm: use the return value of strim()

From: Greg Kroah-Hartman
Date: Tue Aug 22 2023 - 08:03:53 EST


On Thu, Aug 17, 2023 at 10:21:17PM +0800, GONG, Ruiqi wrote:
> From: "GONG, Ruiqi" <gongruiqi1@xxxxxxxxxx>
>
> Make use of the return value of strim() to achieve left-trim as well as
> right-trim, which prevents the following unusual fail case:
>
> # echo " EXCEPTION" > /sys/kernel/debug/provoke-crash/DIRECT
> sh: write error: Invalid argument

And that is correct, don't use leading whitespace, the kernel is not
there to parse it away :)

thanks,

greg k-h