From 0aafe4b0ede1478879e188693165b24a8ae533c4 Mon Sep 17 00:00:00 2001 From: heppen Date: Tue, 16 May 2023 11:50:59 +0800 Subject: [PATCH 2/2] remove inline keyword for build, bugfix: null pointer in memcpy. --- hmdfs_client.c | 3 ++- hmdfs_share.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hmdfs_client.c b/hmdfs_client.c index 31c1a6d38e8f..357365b15fe5 100644 --- a/hmdfs_client.c +++ b/hmdfs_client.c @@ -901,8 +901,9 @@ int hmdfs_send_setxattr(struct hmdfs_peer *con, const char *send_buf, strncpy(req->buf, send_buf, path_len); strncpy(req->buf + path_len + 1, name, name_len); if (!value) { - memcpy(req->buf + path_len + name_len + 2, value, size); req->del = true; + } else { + memcpy(req->buf + path_len + name_len + 2, value, size); } ret = hmdfs_sendmessage_request(con, &sm); kfree(req); diff --git a/hmdfs_share.h b/hmdfs_share.h index 3c055805bd6d..389e26c97c3c 100644 --- a/hmdfs_share.h +++ b/hmdfs_share.h @@ -49,7 +49,7 @@ int insert_share_item(struct hmdfs_share_table *st, struct qstr *relative_path, void update_share_item(struct hmdfs_share_item *item, struct file *file, char *cid); bool in_share_dir(struct dentry *child_dentry); -inline bool is_share_dir(struct inode *inode, const char *name); +bool is_share_dir(struct inode *inode, const char *name); int get_path_from_share_table(struct hmdfs_sb_info *sbi, struct dentry *cur_dentry, struct path *src_path); -- 2.33.0