Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Ira Weiny and committed by
Dave Jiang
66418687 81983758

+2 -1
+2 -1
include/linux/range.h
··· 13 13 return range->end - range->start + 1; 14 14 } 15 15 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) 17 18 { 18 19 return r1->start <= r2->start && r1->end >= r2->end; 19 20 }