Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp657809pxt; Fri, 6 Aug 2021 10:27:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/PF3Thp16sOSnJSQ8QQON1uddgEm/ZREmwvH9gC87dNHVqiuma0DzcPtoGB+pCQGAx60X X-Received: by 2002:a5e:de41:: with SMTP id e1mr997595ioq.125.1628270864488; Fri, 06 Aug 2021 10:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628270864; cv=none; d=google.com; s=arc-20160816; b=SDRNibkw+Y6ChjDhFkj/3WcW/7xREXH52+okh8RrT0AXYJz4wrikT3p5x5C5QAfFcJ GixSfXTnLmVRMQZqLybMsfSE8RmUoYKdfRCPuA65f7lpqQdNeRYvzug8v6H27Or5dEi1 OLZHwj7ap4x3wDmzsxaHXirKwZ616KwY9AsExwUSjCB1pErY8Da3E8NotGb9hNAPm3im ZYud1LMljGmthxvM+hs+horzTp38iQJ9u+dK/Wuqvu7dZbf6tUv7GO4up0w9Tpvyxz8r Z7mkHnJnfCfzqM4C5ihHlVDspduD7PAwrLSEK0VDrGwS/rTdxvhhkecndv7yAQ0YxfG6 UiTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=go/Ikxz+9YJxXVqFDIWifEDBhNwe5cwdk3IxCbit3ac=; b=iDqjC3CArcLDHjFNbawVwkp9gb4f8lCPZDG9p/y7SyGnPfbabrgTNnj/CXA8YXUQLE PtXQFLDL//mup3E0r0zGGKBN0gc9j+c0CFIsHIYoGUiQVISqiYXtg4y4Hv1yy0MW3G3R BYfbZKznmn9IrWrv6xgIDWxzE0/Ocmf18wkQZSWRS7aOEjIGznc4fjuFQSi1op/8t2Rj p4BQBiqlQK3MljKU0ITvO/lkg/iHj8vlqlKwWltKuhDmGmwYvBP32NSw03qYCuQXpSIs 4221XUSm2AY4KUfV8OpGZZ2pjfAuTbJiRTdOu3i5BWQ+yhi16SCkpOrgLKkczhOC/NwJ 4GKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iIXjHiU8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si3078726ilc.131.2021.08.06.10.27.30; Fri, 06 Aug 2021 10:27:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iIXjHiU8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245401AbhHFLOP (ORCPT + 99 others); Fri, 6 Aug 2021 07:14:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245375AbhHFLOM (ORCPT ); Fri, 6 Aug 2021 07:14:12 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 875F2C061798 for ; Fri, 6 Aug 2021 04:13:56 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id o10so11448017ljp.0 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=GggilCSpzo19ngaybmq6eOkWSKZ4DTy15SyAVvdSICOphikSOto1yVGcsUANhyzxss 4eEUPnZexOgXUiO06agxmPX6Qlv4pMoz749Pwia1EVhTVuKXPR1tBD02onDWBXSZAfrW 6enfCiYCskUbQHV98hnOqGJoS3pZrBgFqxYX/FCTZVR1tuDJ/U8Rtocb5WR3AjZsNPxw MliHgb2wLVFYWQaWxnQ5niHJ/oUAAlfJi69Ptw7vzeP/VSx5KJ6aTIqpkZAhUVzNtNqa sZ/zN6e02I3jjHm+55bop1hgLHULbhgMoneIDfgnFhIgsM3aAq/Y/t6WLP0ym9sr+9ka r7SQ== X-Gm-Message-State: AOAM531f8ibJoV/Knivi1DKkjlX/A+dtb+iE0CnD+RKVN1jqVqUTrI5g MVnqB5p3wYaQ/w/wqs2/2ws= 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-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.25.1