linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: zhaimingbing <zhaimingbing@cmss.chinamobile.com>
Cc: rdunlap@infradead.org, James.Bottomley@hansenpartnership.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm:hugetlb_cgroup: Fix the wrong format specifier
Date: Tue, 7 Nov 2023 08:32:24 -0800	[thread overview]
Message-ID: <20231107083224.cf5ca5fd48ca222c1315b4d0@linux-foundation.org> (raw)
In-Reply-To: <20231106082723.8728-1-zhaimingbing@cmss.chinamobile.com>

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.


      parent reply	other threads:[~2023-11-07 16:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06  8:27 zhaimingbing
2023-11-06 20:40 ` Randy Dunlap
2023-11-07 21:13   ` [PATCH V2] mm:hugetlb_cgroup: Optimize variable initialization zhaimingbing
2023-11-10 21:02     ` Randy Dunlap
2023-11-07 16:32 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231107083224.cf5ca5fd48ca222c1315b4d0@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rdunlap@infradead.org \
    --cc=zhaimingbing@cmss.chinamobile.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox