aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiongfeng Wang <xiongfeng.wang@linaro.org>2018-01-08 07:22:33 -0500
committerMike Marshall <hubcap@omnibond.com>2018-02-06 16:38:12 -0500
commit6bdfb48dae8e1b98735bf9387557298d17510be9 (patch)
tree4545b9afbade85593da6d259f4225e879419d9b9
parent4d0cac7e752cccb9eb30cd0f22438b9506ed51bc (diff)
orangefs: use correct string length
gcc-8 reports fs/orangefs/dcache.c: In function 'orangefs_d_revalidate': ./include/linux/string.h:245:9: warning: '__builtin_strncpy' specified bound 256 equals destination size [-Wstringop-truncation] fs/orangefs/namei.c: In function 'orangefs_rename': ./include/linux/string.h:245:9: warning: '__builtin_strncpy' specified bound 256 equals destination size [-Wstringop-truncation] fs/orangefs/super.c: In function 'orangefs_mount': ./include/linux/string.h:245:9: warning: '__builtin_strncpy' specified bound 256 equals destination size [-Wstringop-truncation] We need one less byte or call strlcpy() to make it a nul-terminated string. Signed-off-by: Xiongfeng Wang <xiongfeng.wang@linaro.org> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
-rw-r--r--fs/orangefs/dcache.c2
-rw-r--r--fs/orangefs/namei.c16
-rw-r--r--fs/orangefs/super.c6
3 files changed, 12 insertions, 12 deletions
diff --git a/fs/orangefs/dcache.c b/fs/orangefs/dcache.c
index ae782df5c063..be06e1532a3b 100644
--- a/fs/orangefs/dcache.c
+++ b/fs/orangefs/dcache.c
@@ -33,7 +33,7 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)
33 new_op->upcall.req.lookup.parent_refn = parent->refn; 33 new_op->upcall.req.lookup.parent_refn = parent->refn;
34 strncpy(new_op->upcall.req.lookup.d_name, 34 strncpy(new_op->upcall.req.lookup.d_name,
35 dentry->d_name.name, 35 dentry->d_name.name,
36 ORANGEFS_NAME_MAX); 36 ORANGEFS_NAME_MAX - 1);
37 37
38 gossip_debug(GOSSIP_DCACHE_DEBUG, 38 gossip_debug(GOSSIP_DCACHE_DEBUG,
39 "%s:%s:%d interrupt flag [%d]\n", 39 "%s:%s:%d interrupt flag [%d]\n",
diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c
index c98bba2dbc94..6e3134e6d98a 100644
--- a/fs/orangefs/namei.c
+++ b/fs/orangefs/namei.c
@@ -41,7 +41,7 @@ static int orangefs_create(struct inode *dir,
41 ORANGEFS_TYPE_METAFILE, mode); 41 ORANGEFS_TYPE_METAFILE, mode);
42 42
43 strncpy(new_op->upcall.req.create.d_name, 43 strncpy(new_op->upcall.req.create.d_name,
44 dentry->d_name.name, ORANGEFS_NAME_MAX); 44 dentry->d_name.name, ORANGEFS_NAME_MAX - 1);
45 45
46 ret = service_operation(new_op, __func__, get_interruptible_flag(dir)); 46 ret = service_operation(new_op, __func__, get_interruptible_flag(dir));
47 47
@@ -142,7 +142,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
142 new_op->upcall.req.lookup.parent_refn = parent->refn; 142 new_op->upcall.req.lookup.parent_refn = parent->refn;
143 143
144 strncpy(new_op->upcall.req.lookup.d_name, dentry->d_name.name, 144 strncpy(new_op->upcall.req.lookup.d_name, dentry->d_name.name,
145 ORANGEFS_NAME_MAX); 145 ORANGEFS_NAME_MAX - 1);
146 146
147 gossip_debug(GOSSIP_NAME_DEBUG, 147 gossip_debug(GOSSIP_NAME_DEBUG,
148 "%s: doing lookup on %s under %pU,%d\n", 148 "%s: doing lookup on %s under %pU,%d\n",
@@ -244,7 +244,7 @@ static int orangefs_unlink(struct inode *dir, struct dentry *dentry)
244 244
245 new_op->upcall.req.remove.parent_refn = parent->refn; 245 new_op->upcall.req.remove.parent_refn = parent->refn;
246 strncpy(new_op->upcall.req.remove.d_name, dentry->d_name.name, 246 strncpy(new_op->upcall.req.remove.d_name, dentry->d_name.name,
247 ORANGEFS_NAME_MAX); 247 ORANGEFS_NAME_MAX - 1);
248 248
249 ret = service_operation(new_op, "orangefs_unlink", 249 ret = service_operation(new_op, "orangefs_unlink",
250 get_interruptible_flag(inode)); 250 get_interruptible_flag(inode));
@@ -300,8 +300,8 @@ static int orangefs_symlink(struct inode *dir,
300 300
301 strncpy(new_op->upcall.req.sym.entry_name, 301 strncpy(new_op->upcall.req.sym.entry_name,
302 dentry->d_name.name, 302 dentry->d_name.name,
303 ORANGEFS_NAME_MAX); 303 ORANGEFS_NAME_MAX - 1);
304 strncpy(new_op->upcall.req.sym.target, symname, ORANGEFS_NAME_MAX); 304 strncpy(new_op->upcall.req.sym.target, symname, ORANGEFS_NAME_MAX - 1);
305 305
306 ret = service_operation(new_op, __func__, get_interruptible_flag(dir)); 306 ret = service_operation(new_op, __func__, get_interruptible_flag(dir));
307 307
@@ -372,7 +372,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
372 ORANGEFS_TYPE_DIRECTORY, mode); 372 ORANGEFS_TYPE_DIRECTORY, mode);
373 373
374 strncpy(new_op->upcall.req.mkdir.d_name, 374 strncpy(new_op->upcall.req.mkdir.d_name,
375 dentry->d_name.name, ORANGEFS_NAME_MAX); 375 dentry->d_name.name, ORANGEFS_NAME_MAX - 1);
376 376
377 ret = service_operation(new_op, __func__, get_interruptible_flag(dir)); 377 ret = service_operation(new_op, __func__, get_interruptible_flag(dir));
378 378
@@ -453,10 +453,10 @@ static int orangefs_rename(struct inode *old_dir,
453 453
454 strncpy(new_op->upcall.req.rename.d_old_name, 454 strncpy(new_op->upcall.req.rename.d_old_name,
455 old_dentry->d_name.name, 455 old_dentry->d_name.name,
456 ORANGEFS_NAME_MAX); 456 ORANGEFS_NAME_MAX - 1);
457 strncpy(new_op->upcall.req.rename.d_new_name, 457 strncpy(new_op->upcall.req.rename.d_new_name,
458 new_dentry->d_name.name, 458 new_dentry->d_name.name,
459 ORANGEFS_NAME_MAX); 459 ORANGEFS_NAME_MAX - 1);
460 460
461 ret = service_operation(new_op, 461 ret = service_operation(new_op,
462 "orangefs_rename", 462 "orangefs_rename",
diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c
index a4f4b508eff2..b28b75c7d275 100644
--- a/fs/orangefs/super.c
+++ b/fs/orangefs/super.c
@@ -383,7 +383,7 @@ static int orangefs_unmount(int id, __s32 fs_id, const char *devname)
383 op->upcall.req.fs_umount.id = id; 383 op->upcall.req.fs_umount.id = id;
384 op->upcall.req.fs_umount.fs_id = fs_id; 384 op->upcall.req.fs_umount.fs_id = fs_id;
385 strncpy(op->upcall.req.fs_umount.orangefs_config_server, 385 strncpy(op->upcall.req.fs_umount.orangefs_config_server,
386 devname, ORANGEFS_MAX_SERVER_ADDR_LEN); 386 devname, ORANGEFS_MAX_SERVER_ADDR_LEN - 1);
387 r = service_operation(op, "orangefs_fs_umount", 0); 387 r = service_operation(op, "orangefs_fs_umount", 0);
388 /* Not much to do about an error here. */ 388 /* Not much to do about an error here. */
389 if (r) 389 if (r)
@@ -478,7 +478,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst,
478 478
479 strncpy(new_op->upcall.req.fs_mount.orangefs_config_server, 479 strncpy(new_op->upcall.req.fs_mount.orangefs_config_server,
480 devname, 480 devname,
481 ORANGEFS_MAX_SERVER_ADDR_LEN); 481 ORANGEFS_MAX_SERVER_ADDR_LEN - 1);
482 482
483 gossip_debug(GOSSIP_SUPER_DEBUG, 483 gossip_debug(GOSSIP_SUPER_DEBUG,
484 "Attempting ORANGEFS Mount via host %s\n", 484 "Attempting ORANGEFS Mount via host %s\n",
@@ -520,7 +520,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst,
520 */ 520 */
521 strncpy(ORANGEFS_SB(sb)->devname, 521 strncpy(ORANGEFS_SB(sb)->devname,
522 devname, 522 devname,
523 ORANGEFS_MAX_SERVER_ADDR_LEN); 523 ORANGEFS_MAX_SERVER_ADDR_LEN - 1);
524 524
525 /* mount_pending must be cleared */ 525 /* mount_pending must be cleared */
526 ORANGEFS_SB(sb)->mount_pending = 0; 526 ORANGEFS_SB(sb)->mount_pending = 0;