summaryrefslogtreecommitdiff
path: root/fs/nilfs2/ioctl.c
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@toblux.com>2024-03-06 17:25:47 +0300
committerAndrew Morton <akpm@linux-foundation.org>2024-03-12 23:09:23 +0300
commitadc2c8d0b36f8c97cd3bf7c1420f8d61ee08ce4d (patch)
treeffe2d65633bec23f031e45e3376dc7f83ca35cf8 /fs/nilfs2/ioctl.c
parent8c86fb68ffcb0d8a5418e171c8d359d712912e9b (diff)
downloadlinux-adc2c8d0b36f8c97cd3bf7c1420f8d61ee08ce4d.tar.xz
nilfs2: use div64_ul() instead of do_div()
Fixes Coccinelle/coccicheck warnings reported by do_div.cocci. Compared to do_div(), div64_ul() does not implicitly cast the divisor and does not unnecessarily calculate the remainder. Link: https://lkml.kernel.org/r/20240229210456.63234-2-thorsten.blum@toblux.com Link: https://lkml.kernel.org/r/20240306142547.4612-1-konishi.ryusuke@gmail.com Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs/nilfs2/ioctl.c')
-rw-r--r--fs/nilfs2/ioctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index cfb6aca5ec38..f1a01c191cf5 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -1111,7 +1111,7 @@ static int nilfs_ioctl_set_alloc_range(struct inode *inode, void __user *argp)
segbytes = nilfs->ns_blocks_per_segment * nilfs->ns_blocksize;
minseg = range[0] + segbytes - 1;
- do_div(minseg, segbytes);
+ minseg = div64_ul(minseg, segbytes);
if (range[1] < 4096)
goto out;
@@ -1120,7 +1120,7 @@ static int nilfs_ioctl_set_alloc_range(struct inode *inode, void __user *argp)
if (maxseg < segbytes)
goto out;
- do_div(maxseg, segbytes);
+ maxseg = div64_ul(maxseg, segbytes);
maxseg--;
ret = nilfs_sufile_set_alloc_range(nilfs->ns_sufile, minseg, maxseg);