Skip to content
Commit 1280fbe5 authored by Quanyang Wang's avatar Quanyang Wang Committed by Bruce Ashfield
Browse files

yaffs: fix -Wstringop-overread compile warning in yaffs_fix_null_name



In yaffs_fix_null_name, "if (strnlen(name, YAFFS_MAX_NAME_LENGTH) == 0)"
is used to judge if the "name" string is zero length. But this is wrong
when the "name" char array size is less than YAFFS_MAX_NAME_LENGTH and
this will trigger compile warnig as below:

fs/yaffs2/yaffs_guts.c:4501:13: warning: ‘strnlen’ specified bound 255 exceeds source size 16 [-Wstringop-overread]
 4501 |         if (strnlen(name, YAFFS_MAX_NAME_LENGTH) == 0) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Let's use buffer_size to do this instead of YAFFS_MAX_NAME_LENGTH
because buffer_size is passed to yaffs_fix_null_name by caller with
appropriate value which is fixed to the size of "name" char array.

Signed-off-by: default avatarQuanyang Wang <quanyang.wang@windriver.com>
Signed-off-by: default avatarBruce Ashfield <bruce.ashfield@gmail.com>
parent 76105955
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment