Skip to content

Commit 6641868

Browse files
weiny2davejiang
authored andcommitted
kernel/range: Const-ify range_contains parameters
range_contains() does not modify the range values. David suggested it is safer to keep those parameters as const.[1] Make range parameters const Link: https://lore.kernel.org/all/20241008161032.GB1609@twin.jikos.cz/ [1] Reviewed-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: David Sterba <dsterba@suse.com> Link: https://patch.msgid.link/20241010-const-range-v1-1-afb6e4bfd8ce@intel.com Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 8198375 commit 6641868

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/linux/range.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ static inline u64 range_len(const struct range *range)
1313
return range->end - range->start + 1;
1414
}
1515

16-
static inline bool range_contains(struct range *r1, struct range *r2)
16+
static inline bool range_contains(const struct range *r1,
17+
const struct range *r2)
1718
{
1819
return r1->start <= r2->start && r1->end >= r2->end;
1920
}

0 commit comments

Comments
 (0)