diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index f6d4d5810cc1e20bc6aeb2c054b80f2e71f55f5a..f573cad72b7e2784b0be6ba5c7535a0c5545e8aa 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2798,7 +2798,7 @@ static long btrfs_ioctl_dev_info(struct btrfs_fs_info *fs_info, struct rcu_string *name; name = rcu_dereference(dev->name); - strncpy(di_args->path, name->str, sizeof(di_args->path)); + strncpy(di_args->path, name->str, sizeof(di_args->path) - 1); di_args->path[sizeof(di_args->path) - 1] = 0; } else { di_args->path[0] = '\0';