Possible error in debugfs/file.c
Bjørn Mork
bjorn at mork.no
Tue Dec 2 11:30:28 EST 2014
land.ho87 at gmail.com writes:
> I'm just reading the kernel source and came across this which doesn't look quite right to me:
> 616 size_t size = strlen(file->private_data);
>
> strlen is used here when the pointer points to type:
> 567 struct array_data {
> 568 void *array;
> 569 u32 elements;
> 570 };
No, it doesn't. file->private_data points to a string buffer allocated
in u32_array_open() and filled with a string representation of the
struct array_data, using u32_format_array().
So calling strlen() on it is perfectly valid and reasonable.
Bjørn
More information about the Kernelnewbies
mailing list