From patchwork Fri Jul 21 12:02:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haitao Huang X-Patchwork-Id: 13321940 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4FC6EB64DC for ; Fri, 21 Jul 2023 12:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231274AbjGUMEr (ORCPT ); Fri, 21 Jul 2023 08:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231264AbjGUMEj (ORCPT ); Fri, 21 Jul 2023 08:04:39 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E653F3A92; Fri, 21 Jul 2023 05:04:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689941056; x=1721477056; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4uv9zD1JJrwXe0E9I+ej0cnkJSwI8eyQL9t7kRDmIDo=; b=JrMHGcYdzpNM9PLduB1h5Sn+FLeqPXacQsvIBFPFH4chBjg+pDfZ6ksl GGvwSFeQ0lavCreYuva2h76uzqR6rVFmtXQpbfiwcnkevVEVJXERBKjpG KP9Nf/0N812B8pS90yjPIoJzqX79cMVYFwO7zKGZdvNoMCG5ZyVgVBXGM 96Ho/79J6m0IhJndRgtx7iaoNjKAkejuoGLPdPaSkHuvQ4gyn3pMPtDEq yvbPmIQrDPaqDGeQvH2NNMl1jLvf5lB9F+C9uO179RPXiN4jIsw7rWIrz t+Gt0ZtZCul+y749XaCYxYrMveKYlVMmXTNXG7X5tGzDv5Tlg/YhUIqSR g==; X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="356995884" X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="356995884" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2023 05:02:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="675019242" X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="675019242" Received: from b4969161e530.jf.intel.com ([10.165.56.46]) by orsmga003.jf.intel.com with ESMTP; 21 Jul 2023 05:02:31 -0700 From: Haitao Huang 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 Message-Id: <20230721120231.13916-1-haitao.huang@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.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 --- kernel/cgroup/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 32bf85c60ca3584a7ba3bef19da2779b73b2e7d6 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;