From patchwork Fri Aug 6 11:13:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhansaya Bagdauletkyzy X-Patchwork-Id: 12423233 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED3C5C4338F for ; Fri, 6 Aug 2021 11:13:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 69E4961186 for ; Fri, 6 Aug 2021 11:13:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 69E4961186 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id AD2B68D0001; Fri, 6 Aug 2021 07:13:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A8E736B0071; Fri, 6 Aug 2021 07:13:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 970AA8D0001; Fri, 6 Aug 2021 07:13:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 7A8636B006C for ; Fri, 6 Aug 2021 07:13:57 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 21AC2824999B for ; Fri, 6 Aug 2021 11:13:57 +0000 (UTC) X-FDA: 78444396114.05.61F82B0 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by imf06.hostedemail.com (Postfix) with ESMTP id BE040801E4E2 for ; Fri, 6 Aug 2021 11:13:56 +0000 (UTC) Received: by mail-lj1-f180.google.com with SMTP id h17so72871ljh.13 for ; Fri, 06 Aug 2021 04:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=go/Ikxz+9YJxXVqFDIWifEDBhNwe5cwdk3IxCbit3ac=; b=iIXjHiU8tDqwt3Im+osAnO0L5k2DYaoqtUZakPy5L8itMC4b/1MGTyHBmPxP4vLAFt aZcLS560YuZhW3c+AV1TMxmACEtOao3xq9p9N2ITB+Mv6OILnpxCVxJFw0VIJqMRRj2e GaT5EVBRcYBNE1xg59ZIKeQGlSnvGN9w2HQSqkWyPjwRKUI8akRgvXuBr72K3Kfly6nb 0agM6wn6lFbw7xGue2O0sAJe7HyF6HMpJGjUidaTtDVMs+9wzn7Em5AlIivHOUXZxPWE SEG8DHUYGZjzC3WkXvp6FJj3noJi8En8L79KZBBzdkijel3e7ogb/PUUyQS0CjK4YZoh dRWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=go/Ikxz+9YJxXVqFDIWifEDBhNwe5cwdk3IxCbit3ac=; b=sPMn4yssLIM3tV1MqaYaRloslWp+N87zxkkZIDPFtWM/sIl06J4LcLzFEj2OI2whlH uV1FoMjQK4Vbqs/7NCqgJr8TOcZQqjY8Ehlo6oBo/NIM9iT557SjvljLZdw50mq+m37j n8t3g54tD6yc+dyKcz7VUElug7VIpEYCYNaeB5IhFl4ha4uOxQwEJRERIr/Frtc0igZl iKdfHtHbEtjOB2PdAGVVmRvbwlRY5nfvo//qG25p7/pUd1DKyk2wJyBy0KMCnu1LtTEN EGTA6QqshkBCZTgCDzWy2ElaAiQ6y7ic8/41PGZEtbChTgiEJ15zKvgWWr6FetseinZp Olpg== X-Gm-Message-State: AOAM531Nf902fZx/TtFXiXsTTaBvkU7nCA0xgBnb0aH5T9R0o+3EHyAZ aY1mgm7Vv6ZE9MqM2Qfy8TU= X-Google-Smtp-Source: ABdhPJwivc4jWE5IzbAz8FexMnq16ypilJeHpuD5TYjpPsNxwD5XgWoCouP30v53V3gtag13UmnEKA== X-Received: by 2002:a2e:98d1:: with SMTP id s17mr5947754ljj.457.1628248434912; Fri, 06 Aug 2021 04:13:54 -0700 (PDT) Received: from asus ([93.95.240.58]) by smtp.gmail.com with ESMTPSA id z21sm663477ljj.47.2021.08.06.04.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 04:13:54 -0700 (PDT) Date: Fri, 6 Aug 2021 17:13:51 +0600 From: Zhansaya Bagdauletkyzy To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, hughd@google.com Subject: [PATCH v3] mm: KSM: fix data type Message-ID: <20210806111351.GA71845@asus> MIME-Version: 1.0 Content-Disposition: inline Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=iIXjHiU8; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of zhansayabagdaulet@gmail.com designates 209.85.208.180 as permitted sender) smtp.mailfrom=zhansayabagdaulet@gmail.com X-Stat-Signature: ogx8kf51usebanpbg7bdftfd5qa7csb5 X-Rspamd-Queue-Id: BE040801E4E2 X-Rspamd-Server: rspam01 X-HE-Tag: 1628248436-760107 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: ksm_stable_node_chains_prune_millisecs is declared as int, but in stable__node_chains_prune_millisecs_store(), it can store values up to UINT_MAX. Change its type to unsigned int. Signed-off-by: Zhansaya Bagdauletkyzy --- v2 -> v3: As suggested by Hugh Dickins, - discard changes to ksm_run v1 -> v2: - merge two patches into one v2: https://lore.kernel.org/lkml/20210716055800.GA255851@asus v1: https://lkml.org/lkml/2021/7/15/866 mm/ksm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index 3fa9bc8a67cf..025338128cd9 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -259,7 +259,7 @@ static unsigned long ksm_stable_node_chains; static unsigned long ksm_stable_node_dups; /* Delay in pruning stale stable_node_dups in the stable_node_chains */ -static int ksm_stable_node_chains_prune_millisecs = 2000; +static unsigned int ksm_stable_node_chains_prune_millisecs = 2000; /* Maximum number of page slots sharing a stable node */ static int ksm_max_page_sharing = 256; @@ -3105,11 +3105,11 @@ stable_node_chains_prune_millisecs_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { - unsigned long msecs; + unsigned int msecs; int err; - err = kstrtoul(buf, 10, &msecs); - if (err || msecs > UINT_MAX) + err = kstrtouint(buf, 10, &msecs); + if (err) return -EINVAL; ksm_stable_node_chains_prune_millisecs = msecs;