Skip to content

Commit

Permalink
fix ctl_cbtdirty()
Browse files Browse the repository at this point in the history
Fixed a mistake getting data from an array dirty_sectors.
  • Loading branch information
SergeiShtepa committed Jun 17, 2024
1 parent db96297 commit a4e048f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion module/tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ static int ctl_cbtdirty(struct tracker *tracker, __u8 __user *buf, __u32 *plen)
{
struct cbt_map *cbt_map = tracker->cbt_map;
struct blksnap_cbtdirty arg;
struct blksnap_sectors __user *ranges;
unsigned int inx;

if (!cbt_map)
Expand All @@ -218,11 +219,12 @@ static int ctl_cbtdirty(struct tracker *tracker, __u8 __user *buf, __u32 *plen)
if (copy_from_user(&arg, buf, sizeof(arg)))
return -ENODATA;

ranges = u64_to_user_ptr(arg.dirty_sectors);
for (inx = 0; inx < arg.count; inx++) {
struct blksnap_sectors range;
int ret;

if (copy_from_user(&range, u64_to_user_ptr(arg.dirty_sectors),
if (copy_from_user(&range, ranges + inx,
sizeof(range)))
return -ENODATA;

Expand Down

0 comments on commit a4e048f

Please sign in to comment.