From patchwork Wed Jan 18 03:12:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alexey V. Vissarionov" X-Patchwork-Id: 643990 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 976E3C38142 for ; Wed, 18 Jan 2023 03:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229648AbjARDNE (ORCPT ); Tue, 17 Jan 2023 22:13:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbjARDNC (ORCPT ); Tue, 17 Jan 2023 22:13:02 -0500 Received: from air.basealt.ru (air.basealt.ru [194.107.17.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6865450854 for ; Tue, 17 Jan 2023 19:13:01 -0800 (PST) Received: by air.basealt.ru (Postfix, from userid 490) id E48172F20231; Wed, 18 Jan 2023 03:12:59 +0000 (UTC) Received: from localhost (broadband-188-32-10-232.ip.moscow.rt.ru [188.32.10.232]) by air.basealt.ru (Postfix) with ESMTPSA id 634022F2022A; Wed, 18 Jan 2023 03:12:58 +0000 (UTC) Date: Wed, 18 Jan 2023 06:12:55 +0300 From: "Alexey V. Vissarionov" To: Bart Van Assche Cc: "Alexey V. Vissarionov" , Alexey Khoroshilov , linux-scsi@vger.kernel.org, "Martin K. Petersen" , "James E.J. Bottomley" , "Stephen M. Cameron" , storagedev@microchip.com, Don Brace , lvc-project@linuxtesting.org Subject: [PATCH] scsi: hpsa: fix allocation size for scsi_host_alloc() Message-ID: <20230118031255.GE15213@altlinux.org> References: <20230116133140.GB8107@altlinux.org> <39006233-ff6f-82ad-b772-e00e789375a5@acm.org> <20230117095644.GA12547@altlinux.org> <30d3e555-4fb0-23df-abeb-e1c3dc41543e@ispras.ru> <20230117211201.GD15213@altlinux.org> <531f3f82-712c-eb0b-d22d-710e8a36b3c2@acm.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <531f3f82-712c-eb0b-d22d-710e8a36b3c2@acm.org> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org On 2023-01-17 13:23:19 -0800, Bart Van Assche wrote: > My understanding is that you used an incorrect commit hash. > Hence, it is up to you to fix the commit hash. ACK. Resending: The 'h' is a pointer to struct ctlr_info, so it's just 4 or 8 bytes, while the structure itself is much bigger. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: edd163687ea5 ("[SCSI] hpsa: combine hpsa_scsi_detect and hpsa_register_scsi") Signed-off-by: Alexey V. Vissarionov diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 4dbf51e2623ad543..f6da34850af9dd46 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -5850,7 +5850,7 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h) { struct Scsi_Host *sh; - sh = scsi_host_alloc(&hpsa_driver_template, sizeof(h)); + sh = scsi_host_alloc(&hpsa_driver_template, sizeof(struct ctlr_info)); if (sh == NULL) { dev_err(&h->pdev->dev, "scsi_host_alloc failed\n"); return -ENOMEM;