From mboxrd@z Thu Jan 1 00:00:00 1970 From: bjorn@mork.no (=?utf-8?Q?Bj=C3=B8rn_Mork?=) Date: Tue, 02 Dec 2014 17:30:28 +0100 Subject: Possible error in debugfs/file.c In-Reply-To: <20141202161328.GA15584@arch> (land's message of "Wed, 3 Dec 2014 03:13:28 +1100") References: <20141202161328.GA15584@arch> Message-ID: <878uiqovyz.fsf@nemi.mork.no> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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