From patchwork Mon Nov 11 17:10:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Karan Sanghavi X-Patchwork-Id: 13870993 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3D73D3ABCE for ; Mon, 11 Nov 2024 17:10:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F5D26B0093; Mon, 11 Nov 2024 12:10:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A4B76B0095; Mon, 11 Nov 2024 12:10:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 144E26B0096; Mon, 11 Nov 2024 12:10:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E78456B0093 for ; Mon, 11 Nov 2024 12:10:24 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 86A8C121A19 for ; Mon, 11 Nov 2024 17:10:24 +0000 (UTC) X-FDA: 82774450920.19.B287B65 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf11.hostedemail.com (Postfix) with ESMTP id 4689140025 for ; Mon, 11 Nov 2024 17:09:32 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=F7wxrboL; spf=pass (imf11.hostedemail.com: domain of karansanghvi98@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=karansanghvi98@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731344968; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=7TmUgvo3rAWWE5RdXfwA5YP+7FX339w5GtAM0VCDDD0=; b=dstZaD4C8nb68HT00dH4rk7Z6Sz/eIkMDKLCtHK0LfojO9ms8ICaQqjJbzRHxYc/S1HlWN 1HFQDzmA8Bld5+kFkJw/6T9DZb/GVA5JG9+lmvz0HAXrGWB4p0RhiDgf7EMAWLjwkC4DxM TS9d6oh1fEjBMqUdN4UWT9emUe1811E= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731344968; a=rsa-sha256; cv=none; b=yy40utaPVGLodugVSm3FY4zQInSebDTHB3nyCxy5Pmk1KZC8CthJsuBM09P9jaiy8vqLwa kpB16pspVN0h+OsIOP1nIUVhp7q4eTlxzaI9jAM9RudPhJvT+06eZcngU8o64spwXSvTbY UkcVejdRz8q9URn+Zkxp6jht2VY81bg= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=F7wxrboL; spf=pass (imf11.hostedemail.com: domain of karansanghvi98@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=karansanghvi98@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-20caea61132so41272305ad.2 for ; Mon, 11 Nov 2024 09:10:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731345021; x=1731949821; darn=kvack.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=7TmUgvo3rAWWE5RdXfwA5YP+7FX339w5GtAM0VCDDD0=; b=F7wxrboLBedYhCJy84SlddzdWpuV7o7qhmVJBww8kOtl3fZYbkbev/g6iOQRZyK9MO +9TvB3aqd1o2eOAI/IL+abD8APWqQwV+GayFG5Ob69tLSkjeB5wJu4lcWhac02gdGGNn 69Y6TSlzZoZdLfO+7xxlbzU/lcUwSAawiALV2f7+SrZczpxZ0naHcD23BjgQg4HKNkIC KzBUJiFNxn4ZRa06lN2Zv5w4oaXzSzyl1fZlG3BckSnMlA9FqVzJJ+ofUi7cfwpUtNtg L31dv6CmaxTl30nrUvu0znfBLqhHkjmGFA889F6gTXNzIg6vzLCYTbcwr067OIQaepaM XOuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731345021; x=1731949821; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7TmUgvo3rAWWE5RdXfwA5YP+7FX339w5GtAM0VCDDD0=; b=hZK9iFIlePpawtbzb4flPaEpGBTxVRjCXSsgllHghCORDAKXrD29x0NxocNGB18N0L AC+oeSPnbNV1BrJ4j+71vM6v3o8Qj7c+dy0H7Yz2uMOhLGdfMJL1Ss7FokvzhJoWaYsd ALdTbG82aHy6jUzXZd0qpfA+7UM/vTZxc7P+yCvNO2/dRSzj2U6QxYZ42kgrDTC7zcV4 QfrHqJFQIx5YaGgFm7auvE5uCskba5gPZtdaWLffmpeGGWdLv/Tmmo1mFogXY5WunKk/ ZSTWNkxhjJL4KpIkMBXnNosep40hrswE6CEq56H3b4BcTYPhSRRQ5RntAf1aqfyzAMhC UFbg== X-Gm-Message-State: AOJu0YxBVPDqDwFFL+ktTTfdmaxTwwvPMqjm7Y5hNpzLqPu/wgijvBTl MXYzkNu6WeMkUqoJw+8CAkX6iLN7ugnnmbiRdlTVJ0J2akZcwk8I X-Google-Smtp-Source: AGHT+IGD1ihYcH9brUb7aGVIfVLJtUoQAP/4IyOgHMw8BdSSSs6Gal7OVKQdot3j4F9M9LWLtKEVxw== X-Received: by 2002:a17:902:f641:b0:20b:58f2:e1a0 with SMTP id d9443c01a7336-2118350b048mr197466545ad.18.1731345019981; Mon, 11 Nov 2024 09:10:19 -0800 (PST) Received: from Emma ([2401:4900:1c94:38cd:5054:ff:fe53:2787]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21177e41884sm78216555ad.119.2024.11.11.09.10.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2024 09:10:19 -0800 (PST) From: Karan Sanghavi Date: Mon, 11 Nov 2024 17:10:14 +0000 Subject: [PATCH] mm: shmem: Fix variable type to int to evaluate negative conditions MIME-Version: 1.0 Message-Id: <20241111-unsignedcompare1601569-v1-1-c4a9c3c75a52@gmail.com> X-B4-Tracking: v=1; b=H4sIAHY6MmcC/x2MQQqAIBAAvxJ7TnBNhfpKdDBbbQ9ZKEUQ/T1pb nOYeaBQZiowNA9kurjwnqpg24BfXYokeKkOSiqNFXGmwjHR4vftcJnQSjS2F9LMpu8UakMBanx kCnz/43F63w+Y7ChHaAAAAA== To: Hugh Dickins , Andrew Morton , Gabriel Krisman Bertazi , =?utf-8?q?Andr=C3=A9_Almeida?= , Christian Brauner Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Shuah Khan , Karan Sanghavi X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1731345016; l=1302; i=karansanghvi98@gmail.com; s=20241017; h=from:subject:message-id; bh=f6HKmU0BnhqArbMEdHgt52C/V4l6/0SHG91cR5UNajo=; b=bdyobIMGN6Bm/v1Ve6FUxxV44b3xLkYGetIq5ykQsmBrIdSIc1b2u9JazqbzbhlsLHW37m05d Asasy9eUt3/Dt/C+a5scNEjXyYpd27srLaOmzomKxwQkbvCb/P7Z5t0 X-Developer-Key: i=karansanghvi98@gmail.com; a=ed25519; pk=UAcbefT1C06npNVDJHdgpPqTm4WE9IhaA1fmJb3A37Y= X-Stat-Signature: 6bqssjtwx51h5g9d17f6imyroh9649py X-Rspam-User: X-Rspamd-Queue-Id: 4689140025 X-Rspamd-Server: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J3aqqiznjzCvIMAoEP7MI8jXvqEjoSSU+GiiPrjFrpJsw9VnVSq60dZXx6Zom91miRCsQDxX9z4LR4HC+LfSvMTlx8sYBACMwksqNv7mK/llwdKDNYpl0JJXUaoIs3/Axex3EhN2JnU2zVEt/Hd42mdTDwOnMT7Y+OteHLWxhQO9diG/wfWiPbYxdZOyvx7KSerCIowoxuIJ4Gsy+DM5a28PUxHhYJREZIvimrMJ7xJ5GDwyVKb5HlRDvjHVp218qIxRSEkBI3efT3XR4BbMTGd77b9MAYNcZbKyycWBloDCUk76aEGymMvCpYsKOfFaIPX122MzuUhSbhOep7J2+jmdTGWArXA49FNMnOKWKdvZT0BVmG2+IYRIC31pnAkcrkSumn1WLdw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.050614, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: version variable captures return value from utf8_parse_version function which can be negative, but unsigned won't let it capture, thus missing the further checks on negative values. Fixes: 58e55efd6c72 ("tmpfs: Add casefold lookup support") Signed-off-by: Karan Sanghavi Reviewed-by: André Almeida Reviewed-by: Gabriel Krisman Bertazi --- Coverity Message: CID 1601569: (#1 of 1): Unsigned compared against 0 (NO_EFFECT) unsigned_compare: This less-than-zero comparison of an unsigned value is never true. version < 0U Coverity Link: https://scan7.scan.coverity.com/#/project-view/10043/11354?selectedIssue=1601569 --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- base-commit: 6d59cab07b8d74d0f0422b750038123334f6ecc2 change-id: 20241111-unsignedcompare1601569-05b5932145ef Best regards, diff --git a/mm/shmem.c b/mm/shmem.c index 7987deb2be9b..17a1d4fa8870 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -4367,7 +4367,7 @@ static int shmem_parse_opt_casefold(struct fs_context *fc, struct fs_parameter * bool latest_version) { struct shmem_options *ctx = fc->fs_private; - unsigned int version = UTF8_LATEST; + int version = UTF8_LATEST; struct unicode_map *encoding; char *version_str = param->string + 5;