Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp107539lqb; Thu, 14 Mar 2024 06:47:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXOxUzWQ5ObLU20Qkfo0ZljMk7LLLKn/6ZP8ucPKTnr7CTkP1aUEPje6QjS9FkBXpVM/bEuL5R7o0L2ul4jFZYAP3jOw1a+iGSaF4wYvw== X-Google-Smtp-Source: AGHT+IGOFO0a2d9tz5sg/eztj7T5DBzAngkJqk44C15TsDAXjZPtX8m1ieZkRZomzNESMeFIGEzo X-Received: by 2002:a9d:4e8e:0:b0:6e4:ec75:e7f5 with SMTP id v14-20020a9d4e8e000000b006e4ec75e7f5mr1696442otk.35.1710424053336; Thu, 14 Mar 2024 06:47:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710424053; cv=pass; d=google.com; s=arc-20160816; b=aB9Goe9m0eQ0feqtZWyar8TQBK8qzCUhg7QcfnfiBrlxgCKq1QN6OeuLTYKZPkF+2d Ci4+zRdMhXFIcoTyHq1+mlJyGfzy5gfW1i1SvHsxp1MCS89TrfHbAIvO4bD+rqX8iB9h xg7cBkd1FonYVhzbEfb0y8EZgNhR0ZmPN4EnuMkCbXJa4+zmdhZiPKI94H64LP1UrkcP s17GRj/WdgImxppV4qY/alm3eo96PqOR0puhQwZI48sS9SEYTSausAwX/40iYFi1Vse5 oixsHNiYiRZvsE8gmjFRSOPk7SDNM4yhz32ApH5Eyc+p0w+PEZemypuBSbnm9FpaRGyC hwMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:cc:to:content-language :references:subject:from:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=8+1Ni/QFCmv0JRzcpB0Pqt1z4V7KPxnrrX2R5W4L5tI=; fh=YjCXCv1s9ZbLE3epSHeB9CR3aYMC5nS4IwSigaQgqTQ=; b=XsxesSbmyxSyyqavCY+Pq1Ux82K1xOZmydJ1QZHg3QBHSDMGAbXk6qPswZtC9tJpom UA86B4uZf0whh+nqGkyGi+LoZATIOpYs+Ji3Nwla8OZbAww6IFEQp6T0CVVGUSHFOk+F IGVDu7mPGlQ6mGsgew6NDQmjw3UQF6/D0AhmW9Pw91O29eHALtgcW3Lk5x6dimLtUl2s s+a27FAHoy7lynyPNT5zhzOyb3WOsOWGdhZwSNe7HynlZOYHq4O8nGWuWw/+BfCgHG2b 2YrjS//esz5fEfY/RwO0Kwz1Qlki7yvqAqFRJpPABzA1lGyPqcc7kbVZngLh/WjmTSE3 zVbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=ancud.ru); spf=pass (google.com: domain of linux-kernel+bounces-103316-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103316-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e22-20020a05620a209600b00788643b75aesi1540177qka.331.2024.03.14.06.47.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 06:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103316-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=ancud.ru); spf=pass (google.com: domain of linux-kernel+bounces-103316-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103316-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A54B41C22CF7 for ; Thu, 14 Mar 2024 13:47:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 254366EB56; Thu, 14 Mar 2024 13:46:59 +0000 (UTC) Received: from relay164.nicmail.ru (relay164.nicmail.ru [91.189.117.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8FB85A4E0; Thu, 14 Mar 2024 13:46:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.189.117.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710424018; cv=none; b=PNawFYe+eteJZBvYrBB9xCXQimcu7L4ca5M7aWOs0IdSRmJVGHtvqqTtKyotPpmf4fIKgw7rvKSeF9vRt7kqc8n+VlRgRjo4A58i8MRBpv3Ccia7n/ZD4qjzWTQPNHgnHE8wpodq/pw7Pr+JQ5+ITf3qJwPLbwR00H/3LT+VRIs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710424018; c=relaxed/simple; bh=mWnJcYVexJMfzwrrd4FxMxgxlZ0IYRDe5jxh+xgWppc=; h=Message-ID:Date:MIME-Version:From:Subject:References:To:Cc: In-Reply-To:Content-Type; b=TVqUykKbglH27ecyJ7OQkX3ruvMv7mrzDFm9iT+Y+lumcgOmGtkKmReE85oZ4ZC7+p6fckMBMtpiu63MCUucfPocfuZt8kIqLfJ+NmRk0ORyYQpsUTWbu/mBo5QWTiL2E/sXIyZ2pqr5pV3Yb4ferHoUkuIshx+5M7fJMuBQF8U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ancud.ru; spf=pass smtp.mailfrom=ancud.ru; arc=none smtp.client-ip=91.189.117.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ancud.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ancud.ru Received: from [10.28.138.148] (port=33962 helo=[192.168.95.111]) by relay.hosting.mail.nic.ru with esmtp (Exim 5.55) (envelope-from ) id 1rklGY-0000IY-G1; Thu, 14 Mar 2024 16:37:03 +0300 Received: from [87.245.155.195] (account kiryushin@ancud.ru HELO [192.168.95.111]) by incarp1101.mail.hosting.nic.ru (Exim 5.55) with id 1rklGY-003CBJ-0Q; Thu, 14 Mar 2024 16:37:02 +0300 Message-ID: Date: Thu, 14 Mar 2024 16:36:56 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Nikita Kiryushin Subject: [PATCH] fanotify: remove unneeded sub-zero check for unsigned value References: <> Content-Language: en-US To: Jan Kara Cc: Amir Goldstein , Matthew Bobrowski , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org In-Reply-To: <> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-MS-Exchange-Organization-SCL: -1 Unsigned size_t len in copy_fid_info_to_user is checked for negative value. This check is redundant as it is always false. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 5e469c830fdb ("fanotify: copy event fid info to user") Signed-off-by: Nikita Kiryushin --- fs/notify/fanotify/fanotify_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index fbdc63cc10d9..4201723357cf 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -502,7 +502,7 @@ static int copy_fid_info_to_user(__kernel_fsid_t *fsid, struct fanotify_fh *fh, } /* Pad with 0's */ - WARN_ON_ONCE(len < 0 || len >= FANOTIFY_EVENT_ALIGN); + WARN_ON_ONCE(len >= FANOTIFY_EVENT_ALIGN); if (len > 0 && clear_user(buf, len)) return -EFAULT; -- 2.34.1