From patchwork Thu Jan 12 12:25:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 13097905 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 6A1A5C54EBC for ; Thu, 12 Jan 2023 12:26:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232184AbjALM0i (ORCPT ); Thu, 12 Jan 2023 07:26:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233393AbjALM0R (ORCPT ); Thu, 12 Jan 2023 07:26:17 -0500 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76B55496F4; Thu, 12 Jan 2023 04:26:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673526362; bh=OsbxLgpenh3EmaJqVO2D5pKj+O3xzETqZGytw+PMepM=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=gCQq8YfKeCDxCd8mHHPKSlFxYxq2Vx/KJ6RyfcCAS6ZOliJS9/LIZwxEsZr9I69F1 E9oG9SDnP62gqwcL6yb+c7ubjDXxV/0RvQCtRwhCb9jbx8av9Q2GLX0R9ROk2+2tEu Zj0ZpBspBPc3zDmQO4CQY8ygZkscRaY414GNIkBQ= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Thu, 12 Jan 2023 13:26:02 +0100 (CET) X-EA-Auth: zKf4La/UoBbkbkJBV4yz8GHr94GydOUPwZmccHa9aCZx+8idzk8fE2Xao4lY0aXrBYf5G3IZ40c4vyYqRf1miESw+BK/stO1 Date: Thu, 12 Jan 2023 17:55:57 +0530 From: Deepak R Varma To: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar Subject: [PATCH] scsi: csiostor: use *ptr instead of ptr with sizeof Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The function csio_enqueue_evt() should be passed the actual length of the event/message so that it can be fully copied over to the event queue. Use the sizeof(*ptr) to get the real message length instead of sizeof(ptr). Issue identified using the noderef,cocci coccinelle semantic patch. Signed-off-by: Deepak R Varma --- Please note: The change is compile tested only. drivers/scsi/csiostor/csio_mb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/csiostor/csio_mb.c b/drivers/scsi/csiostor/csio_mb.c index 94810b19e747..4df8a4df4408 100644 --- a/drivers/scsi/csiostor/csio_mb.c +++ b/drivers/scsi/csiostor/csio_mb.c @@ -1551,7 +1551,7 @@ csio_mb_isr_handler(struct csio_hw *hw) * Enqueue event to EventQ. Events processing happens * in Event worker thread context */ - if (csio_enqueue_evt(hw, CSIO_EVT_MBX, mbp, sizeof(mbp))) + if (csio_enqueue_evt(hw, CSIO_EVT_MBX, mbp, sizeof(*mbp))) CSIO_INC_STATS(hw, n_evt_drop); return 0;