Message ID | 20231106082723.8728-1-zhaimingbing@cmss.chinamobile.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm:hugetlb_cgroup: Fix the wrong format specifier | expand |
On 11/6/23 00:27, zhaimingbing wrote: > The long type should use "%ld" instead of "%lu". > > Signed-off-by: zhaimingbing <zhaimingbing@cmss.chinamobile.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Thanks. > --- > mm/hugetlb_cgroup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c > index dedd2edb0..3c132795c 100644 > --- a/mm/hugetlb_cgroup.c > +++ b/mm/hugetlb_cgroup.c > @@ -696,7 +696,7 @@ static int __hugetlb_events_show(struct seq_file *seq, bool local) > else > max = atomic_long_read(&h_cg->events[idx][HUGETLB_MAX]); > > - seq_printf(seq, "max %lu\n", max); > + seq_printf(seq, "max %ld\n", max); > > return 0; > }
On Mon, 6 Nov 2023 16:27:23 +0800 zhaimingbing <zhaimingbing@cmss.chinamobile.com> wrote: > The long type should use "%ld" instead of "%lu". > > ... > > --- a/mm/hugetlb_cgroup.c > +++ b/mm/hugetlb_cgroup.c > @@ -696,7 +696,7 @@ static int __hugetlb_events_show(struct seq_file *seq, bool local) > else > max = atomic_long_read(&h_cg->events[idx][HUGETLB_MAX]); > > - seq_printf(seq, "max %lu\n", max); > + seq_printf(seq, "max %ld\n", max); > > return 0; > } Well. We can't have a negative number of events. If we had an atomic_ulong_t, we'd be using that for ->events[]. Perhaps giving `max' an unsigned long type would better represent the intent in there.
diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index dedd2edb0..3c132795c 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -696,7 +696,7 @@ static int __hugetlb_events_show(struct seq_file *seq, bool local) else max = atomic_long_read(&h_cg->events[idx][HUGETLB_MAX]); - seq_printf(seq, "max %lu\n", max); + seq_printf(seq, "max %ld\n", max); return 0; }
The long type should use "%ld" instead of "%lu". Signed-off-by: zhaimingbing <zhaimingbing@cmss.chinamobile.com> --- mm/hugetlb_cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)