Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp139431rdb; Mon, 15 Jan 2024 15:33:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IFe1rcjOVDTQGbyj6OwpdcZ4sBkiBavdPLeuD7HC2F6FxlSTEK/nBKDfODBOYi/mzGl/aNS X-Received: by 2002:a05:6808:219d:b0:3bd:47b4:77cf with SMTP id be29-20020a056808219d00b003bd47b477cfmr7590245oib.29.1705361606114; Mon, 15 Jan 2024 15:33:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705361606; cv=none; d=google.com; s=arc-20160816; b=vCwwmNjTNWt8byoSTgPrA5Gk2pcWDSDd2bSjPge+4TFn4YFgwqdvNz2rt3p4yBAeoZ f6ZSnDcxxRMg67uEMGPC64gYgloo3R1Ubs2WKi549QhBAYhgeCypV1GX/aQf80RDte75 6/gUuXplv2sJx/m8+EE8o8xIS675mfgsWGnyYXrMYSmkHU7fVEMLLczm2JjUdB95KFeA U/rX9P2jaLICsds3+oFYh3BLiNgZK5DdRqvdg9M2TDInSswnGN1VGNGN7qL76qL51KDJ m6G3kMzbAm9aSSmc0RN1U4dvZWYVtcV04LdUmzTHiw0oYId9FmnvlPy+ACuugzy+Csd2 qcDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=87v+5QKZVtZ+xqPTpmSntKeOiJPnnfGcQlxBC9saBhY=; fh=ZS7UqDFLgWcndljgFJIr0SCG2AQNJ//2rzcMQjFKLP0=; b=X5HeSxkMfN8jyI1TEvjAcNK+GJ+Ibk1VOROiDBYQsgff4OFctp2bQg0yfgNgt9iqv4 7euzTLhccYuMgygq+U+xNZZx6uAtI+ExJ/Cg8O5r59z1fVbbEcjVvvj4Z2xHcbC5O9/O cjP1R3nZcpnhXV1dU4RNEixZayGZRvwymvdPiEhGK+5F1d1x+W3+W1fVi5Xlv4XfeJ09 mTetidH9mWstKwYNWUc7+o+Sh5uvjawCdslY0bQDpNkzCJZhftMb4MqKvw/9pB9E31pr QkW024lEHWHN66+0pnsMBmBwHQ2X7xzpTdcQBgugss2+D2g+X2y2BHJYFgVtsa5i2HTw BMZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LpnOxmdY; spf=pass (google.com: domain of linux-kernel+bounces-26558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26558-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ct17-20020a056a000f9100b006db79fe0e59si3365232pfb.96.2024.01.15.15.33.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 15:33:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LpnOxmdY; spf=pass (google.com: domain of linux-kernel+bounces-26558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26558-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 99B7DB22303 for ; Mon, 15 Jan 2024 23:32:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACD101BDFC; Mon, 15 Jan 2024 23:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LpnOxmdY" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DDA961BDEC; Mon, 15 Jan 2024 23:26:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84802C43399; Mon, 15 Jan 2024 23:26:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705361176; bh=fX2Z+o1ROV5wMcL/txt8N6Dwd1S7nNyfxL5JKs4aazM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LpnOxmdY3C9Pgvcgtnt/NvFINfWCO/piOdaiTqtnm1YdIBN4/6UOgKZfnT5yiQA+k 0tvvMlY1wvgtvSgBos8ol/DiNW7kEmWuHkXH6TVJHHisyhzioN+XAm+fd4RTUA/PZz 1GekioqnBjp9UVh6kV+s07rxi+RU3haqsQ66/tpYECXgkDJwZPkxyPg/QAJdJeROGi uuzEPQSzb4TGMGEEDH9M/bkqVOgRbUFGR9tLR9FRbizuJwHT2cqT3AiF72VfJbpDP4 NWB8/BfvgF/Nv/FpFICVTVfzwdrQK+KxVXg+Q7sxRejMDELer84vY2Fsz6zMc/OOIj D/LLxxw1hKFcw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dmitry Antipov , Christian Brauner , Sasha Levin , dhowells@redhat.com, nick.alcock@oracle.com, keescook@chromium.org, ddiss@suse.de, pstanner@redhat.com, code@siddh.me Subject: [PATCH AUTOSEL 6.1 02/14] watch_queue: fix kcalloc() arguments order Date: Mon, 15 Jan 2024 18:25:36 -0500 Message-ID: <20240115232611.209265-2-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115232611.209265-1-sashal@kernel.org> References: <20240115232611.209265-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.73 Content-Transfer-Encoding: 8bit From: Dmitry Antipov [ Upstream commit 1bfc466b13cf6652ba227c282c27a30ffede69a5 ] When compiling with gcc version 14.0.0 20231220 (experimental) and W=1, I've noticed the following warning: kernel/watch_queue.c: In function 'watch_queue_set_size': kernel/watch_queue.c:273:32: warning: 'kcalloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 273 | pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL); | ^~~~~~ Since 'n' and 'size' arguments of 'kcalloc()' are multiplied to calculate the final size, their actual order doesn't affect the result and so this is not a bug. But it's still worth to fix it. Signed-off-by: Dmitry Antipov Link: https://lore.kernel.org/r/20231221090139.12579-1-dmantipov@yandex.ru Signed-off-by: Christian Brauner Signed-off-by: Sasha Levin --- kernel/watch_queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c index 442bb92212f2..9bdcfdef0509 100644 --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -271,7 +271,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes) goto error; ret = -ENOMEM; - pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL); + pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL); if (!pages) goto error; -- 2.43.0