From patchwork Mon May 27 21:08:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13675829 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7ABB6C25B74 for ; Mon, 27 May 2024 21:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=El0JAePAjELGLxR+HWHEH5w1sWbS3ZCOVhaGiIWQmok=; b=sYjRQwkkP7WhiF pq3XHbQkIGuTvL3NZckgW/N51j9gKHPHO2stzdKtWJokMDX/+Cd4mkQZSniil421gR01utjz3HyA2 i2AwmCSIyLHbMswEPPSYljWcL1KP7VItphP1HQzZY284ekbh+atfvEcTqdCF/UIo7mlXxc0RmZBc+ mXQQGHM9Wyr94Le/DL9Z43QmSscXRu/ff0dPzMWrCZmguPESE7h8544XARgSPqC5DY4OXAvqtEYcX tP1RnqQcMbYist9T/80wDa1oFX/on5kJw+4OMpduZ9eDCuLo6q/YfEAGgRSi5zlKQjwpau7LjTIXW qwjMpOyaUW1iJYr+evOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBhaz-0000000GKUp-1nje; Mon, 27 May 2024 21:09:29 +0000 Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBhaa-0000000GK8f-1lIp for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2024 21:09:06 +0000 Received: by mail-qv1-xf36.google.com with SMTP id 6a1803df08f44-6ab9e011f62so30881126d6.0 for ; Mon, 27 May 2024 14:09:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1716844143; x=1717448943; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=entYDpzpynGnajXkQLwb6P9rzIVA7SLTRgQ0ZRMWf+M=; b=ln81AYpQmtBq0JVlG2c+nrur3dTQPpW4piyzkkaZCPz63q+QApL9+uNhzzj4Nv1C0C viRvhsyqF1TJmArSjqmeAfnQYs9DkKJh83UJI2vjYnWM5Re6WLmW/50AqvzMlRmZIifZ dz14mdA/ISl5I6iYshOmTO371w8mIkW/QJHXE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716844143; x=1717448943; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=entYDpzpynGnajXkQLwb6P9rzIVA7SLTRgQ0ZRMWf+M=; b=vuMbznxyMkWHouo0xSCEGtZW7Da02buVp2J2x4TOPzIIkQwHiCl0EwAMEBlHvqlDR5 vr1MihH7STU3VniUug/HkyVhMgmjqqWWSGhxi4EUVS8GW759hlifsYNRyeHNluKI6avO aKeo++VB/YPfGhn1c5/aClME0JGVAkrd6t8v1hqM82C+tcLFPCCujcAb8+xHSJbnd2nK 4tku1caYPh2L+2ejeBFv50g4BTrNhjxuKGbJ/PNIB/HYPDdJlMI0mHQ2MkvVdu3Of2ex cMkVUBcPOEdshgf+5m+1LYcr+XiwXWMd+kBZZz25YXJApkjBvcAu2bLWgOJKb/3y/GTG FRew== X-Forwarded-Encrypted: i=1; AJvYcCXQm2a6EMZVMiJea42pnPmSYBTZvMQs6Yn1lrk3w7qkW1py0KhokSfw6oaUGndA5fYdYvxEYM8nRdCv+iFkJpBV05BQkncWTzr821JMG0QqWtqn6uc= X-Gm-Message-State: AOJu0YxGTFGaGB+cxfqRTkwBxgv7WwX1gx5z30w8oUhKl1m1Q2JtpLbv kHJC/HlG/WFtLOZZUXqcla240MVOm1FBL4W0VW9p3WNoCJmG6aCYzg542JkpcA== X-Google-Smtp-Source: AGHT+IGRTkEFJzLLbC9/MtoTsg0EW+dVQWuLn/GRcDLGaCVnhgLZ5sKm7tGGTDdrZIg9lepBsZ8a+w== X-Received: by 2002:a05:6214:2b0b:b0:6ad:7070:4e1c with SMTP id 6a1803df08f44-6ad707059e8mr106586636d6.19.1716844142698; Mon, 27 May 2024 14:09:02 -0700 (PDT) Received: from denia.c.googlers.com (125.135.86.34.bc.googleusercontent.com. [34.86.135.125]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6ad850a6dc7sm9511866d6.93.2024.05.27.14.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 14:09:01 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 27 May 2024 21:08:58 +0000 Subject: [PATCH v3 08/18] media: siano: Use flex arrays for sms_firmware MIME-Version: 1.0 Message-Id: <20240527-cocci-flexarray-v3-8-cda09c535816@chromium.org> References: <20240527-cocci-flexarray-v3-0-cda09c535816@chromium.org> In-Reply-To: <20240527-cocci-flexarray-v3-0-cda09c535816@chromium.org> To: Michael Tretter , Pengutronix Kernel Team , Mauro Carvalho Chehab , Laurent Pinchart , Michal Simek , Andy Walls , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Hans Verkuil , Ricardo Ribalda X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_140904_629387_1DEFF6D9 X-CRM114-Status: GOOD ( 12.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Replace old style single array member, with flex array. The struct is allocated, but it seems like there was an over allocation error: fw_buf = kmalloc(ALIGN(fw->size + sizeof(struct sms_firmware), SMS_ALLOC_ALIGNMENT), GFP_KERNEL | coredev->gfp_buf_flags); This change fixes this cocci warning: drivers/media/common/siano/smscoreapi.h:669:6-13: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) Signed-off-by: Ricardo Ribalda --- drivers/media/common/siano/smscoreapi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/common/siano/smscoreapi.h b/drivers/media/common/siano/smscoreapi.h index bc61bc8b9ea9..82d9f8a64d99 100644 --- a/drivers/media/common/siano/smscoreapi.h +++ b/drivers/media/common/siano/smscoreapi.h @@ -666,7 +666,7 @@ struct sms_firmware { u32 check_sum; u32 length; u32 start_address; - u8 payload[1]; + u8 payload[]; }; /* statistics information returned as response for