From: Haitao Huang <haitao.huang@linux.intel.com>
To: tj@kernel.org
Cc: cgroups@vger.kernel.org, dave.hansen@linux.intel.com,
haitao.huang@linux.intel.com, hannes@cmpxchg.org,
jarkko@kernel.org, kai.huang@intel.com, kristen@linux.intel.com,
linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org,
lizefan.x@bytedance.com, reinette.chatre@intel.com,
vipinsh@google.com, zhiquan1.li@intel.com
Subject: [PATCH] cgroup/misc: Store atomic64_t reads to u64
Date: Fri, 21 Jul 2023 05:02:31 -0700 [thread overview]
Message-ID: <20230721120231.13916-1-haitao.huang@linux.intel.com> (raw)
In-Reply-To: <ZLcXmvDKheCRYOjG@slm.duckdns.org>
Change 'new_usage' type to u64 so it can be compared with unsigned 'max'
and 'capacity' properly even if the value crosses the signed boundary.
Signed-off-by: Haitao Huang <haitao.huang@linux.intel.com>
---
kernel/cgroup/misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/cgroup/misc.c b/kernel/cgroup/misc.c
index abbe9aa5cdd1..79a3717a5803 100644
--- a/kernel/cgroup/misc.c
+++ b/kernel/cgroup/misc.c
@@ -142,7 +142,7 @@ int misc_cg_try_charge(enum misc_res_type type, struct misc_cg *cg, u64 amount)
struct misc_cg *i, *j;
int ret;
struct misc_res *res;
- s64 new_usage;
+ u64 new_usage;
if (!(valid_type(type) && cg && READ_ONCE(misc_res_capacity[type])))
return -EINVAL;
base-commit: 32bf85c60ca3584a7ba3bef19da2779b73b2e7d6
--
2.25.1
next prev parent reply other threads:[~2023-07-21 12:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 18:47 [PATCH] cgroup/misc: Fix an overflow Haitao Huang
2023-07-17 18:51 ` Tejun Heo
2023-07-17 18:55 ` Jarkko Sakkinen
2023-07-17 18:57 ` Tejun Heo
2023-07-17 19:01 ` Haitao Huang
2023-07-17 20:19 ` Haitao Huang
2023-07-17 20:37 ` Tejun Heo
2023-07-18 1:08 ` [PATCH 1/2] " Haitao Huang
2023-07-18 1:08 ` [PATCH 2/2] cgroup/misc: Change counters to be explicit 64bit types Haitao Huang
2023-07-18 22:52 ` Tejun Heo
2023-07-21 2:48 ` Haitao Huang
2023-07-21 12:02 ` Haitao Huang [this message]
2023-07-21 18:10 ` [PATCH] cgroup/misc: Store atomic64_t reads to u64 Tejun Heo
2023-07-18 1:11 ` [PATCH] cgroup/misc: Fix an overflow Haitao Huang
2023-07-18 15:41 ` Jarkko Sakkinen
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=20230721120231.13916-1-haitao.huang@linux.intel.com \
--to=haitao.huang@linux.intel.com \
--cc=cgroups@vger.kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=hannes@cmpxchg.org \
--cc=jarkko@kernel.org \
--cc=kai.huang@intel.com \
--cc=kristen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=reinette.chatre@intel.com \
--cc=tj@kernel.org \
--cc=vipinsh@google.com \
--cc=zhiquan1.li@intel.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;
as well as URLs for NNTP newsgroup(s).