[LTP] [PATCH v2 4/7] Add lsm_get_self_attr03 test

Andrea Cervesato andrea.cervesato@suse.com
Fri Mar 21 13:23:35 CET 2025


Hi Cyril,

On 3/4/25 14:11, Cyril Hrubis wrote:
>> +
>> +	count = TST_EXP_POSITIVE(
>> +		lsm_get_self_attr(LSM_ATTR_CURRENT, ctx, &size, 0));
>                                                            ^
> 							  This does not
> 							  look right.
>
>
> Shouldn't we pass size initialized to size of the ctx->ctx[] there?
>
> You are mixing the size of the attr[] array and the size of the ctx
> into a single variable which isn't right at all. The attr[] size can
> also be much smaller, since it's just a single string.

This is how kselftests are working as well, so I'm a bit confused.
According to the documentation of lsm_get_self_attr:

  * @size: pointer to the size of space available to receive the data

I guess kselftests are giving a bare minimum size according to the 
memory pages.

Andrea


More information about the ltp mailing list