Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp567908rwb; Tue, 29 Nov 2022 02:26:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf6aSjv1vFr4KUxQahRbHdjKU6KTCLSLIpurBHvtCzk+2HT3K5Dlz5auvSa4NnUfR3dCl0WD X-Received: by 2002:aa7:8a0c:0:b0:56c:2a86:d74 with SMTP id m12-20020aa78a0c000000b0056c2a860d74mr36657409pfa.73.1669717579109; Tue, 29 Nov 2022 02:26:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669717579; cv=none; d=google.com; s=arc-20160816; b=JSu5wRGAsK1/FKsT+lV0s9jVCYfBYv5iuTyS66OAacy2DqxAdW/TaWSdjaPrnikx0G DdIS2bXArfMzzsHUpfU1t0UMEwtyZex+Y85ca69fPEKmFAAKc3zNcmEH+cAmmfpjOCZw uKHcPtm9mdpxJ7bzxLRGgjlqtJtsaDA8ZEJ/wfolQ/yTwaMUpJZ5Aay0QPqAHQ4AgBg5 z/mN8eYhUbjLi3dHQAlZ21qUnNFl8ls7Gb2GYBt4eTmfnooFq+1bYuyLpmkQ6GNCz8JM EGawvDfrD1GLrWatMOd9b8jvYkAma9UKQ/C67ZBFK7r7JXHnIlMJ6LrvsFGQqsOnRGQY k9+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature:dkim-filter; bh=34cO/GV9E8UjUhEC8QC8GWzLPIeTkL25yYRQJuX+RJo=; b=SgogGyb4ukd962OzW/Se6OHU5Dy8gHFEE11srRB7YAR+8TXV3e7hGiBa5cF9DqM9/D WlAjAGlIbEaUmtI8G3feZZe+nCWmbcvFzLREmeAh/lar3/HrCBr5PO2cRlF2TyWtc3Ct BETKaNRC5nJyf2EJTDmCc1SXS1LaV4mrgY1gIUJx7KleLyXUi87xObkEfyYCO+JghP7I smCO5KhRNRJu3VP09a5MQTR2QPbsSZgVkga2Hlpi/mT5SrZbgJZCucMLM9L2VvWhKGTT Ve32FbM9LgpMHCoi9iHTnx7XKFRjncnIYpLXmwfkqXLlBza72NjiXUkgpfUlSEXKIheM fUjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infotecs.ru header.s=mx header.b=wNXwNb2P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=infotecs.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020a17090311c500b00186ab01ecd5si16018628plh.219.2022.11.29.02.26.08; Tue, 29 Nov 2022 02:26:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infotecs.ru header.s=mx header.b=wNXwNb2P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=infotecs.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230358AbiK2J3h (ORCPT + 83 others); Tue, 29 Nov 2022 04:29:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231838AbiK2J3Z (ORCPT ); Tue, 29 Nov 2022 04:29:25 -0500 X-Greylist: delayed 335 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 29 Nov 2022 01:29:18 PST Received: from mx0.infotecs.ru (mx0.infotecs.ru [91.244.183.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A0C45C759 for ; Tue, 29 Nov 2022 01:29:18 -0800 (PST) Received: from mx0.infotecs-nt (localhost [127.0.0.1]) by mx0.infotecs.ru (Postfix) with ESMTP id A26311206575; Tue, 29 Nov 2022 12:23:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx0.infotecs.ru A26311206575 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=infotecs.ru; s=mx; t=1669713819; bh=34cO/GV9E8UjUhEC8QC8GWzLPIeTkL25yYRQJuX+RJo=; h=From:To:CC:Subject:Date:From; b=wNXwNb2PyZlCiXVoV0zKPn7PzUo6VPMGh5pnGxcAWqDJIjVYM2N9e/qfpR2mJ+T7G 809eDYORrDSuCmMXodchd8NgtOFf6iZCuzsOZn1PvDVtHqI2rgSejZYXcy5D6yBg15 69h5dAPnu5OlJeAL/rMFUJjt7pm7w5g/bsH4Gsig= Received: from msk-exch-01.infotecs-nt (msk-exch-01.infotecs-nt [10.0.7.191]) by mx0.infotecs-nt (Postfix) with ESMTP id 955A130CCD5E; Tue, 29 Nov 2022 12:23:38 +0300 (MSK) Received: from msk-exch-01.infotecs-nt (10.0.7.191) by msk-exch-01.infotecs-nt (10.0.7.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.12; Tue, 29 Nov 2022 12:23:38 +0300 Received: from msk-exch-01.infotecs-nt ([fe80::89df:c35f:46be:fd07]) by msk-exch-01.infotecs-nt ([fe80::89df:c35f:46be:fd07%14]) with mapi id 15.02.1118.012; Tue, 29 Nov 2022 12:23:38 +0300 From: Gavrilov Ilia To: Andrew Morton CC: Gavrilov Ilia , Colin Ian King , wuchi , Jens Axboe , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" Subject: [PATCH] relay: Fix type mismatch when allocating memory in relay_create_buf() Thread-Topic: [PATCH] relay: Fix type mismatch when allocating memory in relay_create_buf() Thread-Index: AQHZA9RDQYv1MYkRoUybHQ6EQG7cLA== Date: Tue, 29 Nov 2022 09:23:38 +0000 Message-ID: <20221129092002.3538384-1-Ilia.Gavrilov@infotecs.ru> Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.17.0.10] x-exclaimer-md-config: 208ac3cd-1ed4-4982-a353-bdefac89ac0a Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Lua-Profiles: 173812 [Nov 29 2022] X-KLMS-AntiSpam-Version: 5.9.59.0 X-KLMS-AntiSpam-Envelope-From: Ilia.Gavrilov@infotecs.ru X-KLMS-AntiSpam-Rate: 0 X-KLMS-AntiSpam-Status: not_detected X-KLMS-AntiSpam-Method: none X-KLMS-AntiSpam-Auth: dkim=none X-KLMS-AntiSpam-Info: LuaCore: 502 502 69dee8ef46717dd3cb3eeb129cb7cc8dab9e30f6, {Tracking_from_domain_doesnt_match_to}, infotecs.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;127.0.0.199:7.1.2 X-MS-Exchange-Organization-SCL: -1 X-KLMS-AntiSpam-Interceptor-Info: scan successful X-KLMS-AntiPhishing: Clean, bases: 2022/11/29 05:53:00 X-KLMS-AntiVirus: Kaspersky Security for Linux Mail Server, version 8.0.3.30, bases: 2022/11/29 04:55:00 #20623102 X-KLMS-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 'padding' field of the 'rchan_buf' structure is an array of 'size_t' elements, but the memory is allocated for an array of 'size_t *' elements. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: b86ff981a825 ("[PATCH] relay: migrate from relayfs to a generic rela= y API") Signed-off-by: Ilia.Gavrilov --- kernel/relay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/relay.c b/kernel/relay.c index d7edc934c56d..88bcb09f0a1f 100644 --- a/kernel/relay.c +++ b/kernel/relay.c @@ -148,13 +148,13 @@ static struct rchan_buf *relay_create_buf(struct rcha= n *chan) { struct rchan_buf *buf; =20 - if (chan->n_subbufs > KMALLOC_MAX_SIZE / sizeof(size_t *)) + if (chan->n_subbufs > KMALLOC_MAX_SIZE / sizeof(size_t)) return NULL; =20 buf =3D kzalloc(sizeof(struct rchan_buf), GFP_KERNEL); if (!buf) return NULL; - buf->padding =3D kmalloc_array(chan->n_subbufs, sizeof(size_t *), + buf->padding =3D kmalloc_array(chan->n_subbufs, sizeof(size_t), GFP_KERNEL); if (!buf->padding) goto free_buf; --=20 2.30.2