From 183c5c5107d4a2f7f550c0cc8b572aa127fbfa9c Mon Sep 17 00:00:00 2001 From: liuzerun Date: Tue, 27 Feb 2024 12:12:54 +0000 Subject: [PATCH] strncmp Signed-off-by: liuzerun fix https://gitee.com/openharmony/kernel_linux_5.10/issues/I8YUS6 --- fs/hmdfs/hmdfs_share.c | 8 ++++---- fs/hmdfs/inode_root.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/hmdfs/hmdfs_share.c b/fs/hmdfs/hmdfs_share.c index 4035ebf9ffa6..436d3324fc19 100644 --- a/fs/hmdfs/hmdfs_share.c +++ b/fs/hmdfs/hmdfs_share.c @@ -157,13 +157,13 @@ bool in_share_dir(struct dentry *child_dentry) inline bool is_share_dir(struct inode *inode, const char *name) { - return (S_ISDIR(inode->i_mode) && - !strncmp(name, SHARE_RESERVED_DIR, strlen(SHARE_RESERVED_DIR))); + return (S_ISDIR(inode->i_mode) && + !strncmp(name, SHARE_RESERVED_DIR, sizeof(SHARE_RESERVED_DIR))); } int get_path_from_share_table(struct hmdfs_sb_info *sbi, - struct dentry *cur_dentry, - struct path *src_path) + struct dentry *cur_dentry, + struct path *src_path) { struct hmdfs_share_item *item; const char *path_name; diff --git a/fs/hmdfs/inode_root.c b/fs/hmdfs/inode_root.c index 91ca37bb6b7c..d1d996eef369 100644 --- a/fs/hmdfs/inode_root.c +++ b/fs/hmdfs/inode_root.c @@ -143,7 +143,7 @@ struct dentry *hmdfs_device_lookup(struct inode *parent_inode, trace_hmdfs_device_lookup(parent_inode, child_dentry, flags); if (!strncmp(d_name, DEVICE_VIEW_LOCAL, - sizeof(DEVICE_VIEW_LOCAL) - 1)) { + sizeof(DEVICE_VIEW_LOCAL))) { err = init_hmdfs_dentry_info(sbi, child_dentry, HMDFS_LAYER_SECOND_LOCAL); if (err) { @@ -170,7 +170,7 @@ struct dentry *hmdfs_device_lookup(struct inode *parent_inode, goto out; } } else if (!strncmp(d_name, DEVICE_VIEW_CLOUD, - sizeof(DEVICE_VIEW_CLOUD) - 1)) { + sizeof(DEVICE_VIEW_CLOUD))) { err = init_hmdfs_dentry_info(sbi, child_dentry, HMDFS_LAYER_SECOND_CLOUD); if (err) { -- Gitee