Possible error in debugfs/file.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 };

I think line 616 should probably be something like:
size_t size = file->private_data.elements*sizeof(u32);

I think strlen would terminate incorrectly on any null byte, and is unnecessary
since the data is already counted.

Is this a legitimate criticism?

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux