From patchwork Tue May 7 16:27:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13657466 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 36D8AC25B4F for ; Tue, 7 May 2024 16:27:56 +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=QaO2bNnF968t7JXaftnAFuEpo1t26tO8D7IcFSYv0GE=; b=HvpMJDpREZIVM4 rErzcTyQL9Y7G2Fkc9wHhRG/JGmJoxNfM0GyuTHXIRsqthAGtqHrr4ttVVCJ6yRyljcBKBFia3J85 GKreAFo4v3tYB1lGVdjQMZmTj6jIu8jogW7l6SRK9+Qy9JN/z7PR//CMcy0LnapYz6pieRW1FoI0r s9E16+P7qhRUjWt5sdzAOV6subJBCB5e9+s/GDdZeb011uJnKEAaOOdt6v2hulMA0BEVq16Guqr9n fC577ryVI15+pNmIzaQ6IQVLkkFMFIqCSJYAO6PD+TlnijML8C8VDGltObogCEuu9cpucr5bhIILl KDO0KpgrvMKO3DqdEnBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4NfH-0000000BxsJ-0VHj; Tue, 07 May 2024 16:27:39 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Nf2-0000000BxeV-0osn for linux-arm-kernel@bombadil.infradead.org; Tue, 07 May 2024 16:27:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=JKfhOSoHE1VqyRhgB0xYInvnK6a8zz5LZUqmCULZe+M=; b=UotZR0sQ66sU53KEP7xyEym34e asrxDmpJTiYqQ+vo3TMpUb7Vb3aFKyJpYxjihBv2B61iaTHXkhZaJ/9OBPCczjuivdaptAtEuax8a Xnv5SPZNJVcnBU7lHfOEAWoMfkkl4DMbUA2H3H5bd9Ga7ZPqNWOzc7dDN437UOTS4txTNaDJkuDRs FV6LGlTDUody2cvAOTgWm2L+C/XcD3LVaRq+uRPawZGTsO1NVK0YoLNtXAljKjVXswtqd2SrJ7azU fp9ZdYj+oja3W9H0hHMLp2+y4L1xTZjqeaZNKLNyKETiIz/jYnkWYl/S2YW7bn+Uhua4nb6DAWiPS 3ThKXH/A==; Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Nex-00000002AXw-1ZIT for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2024 16:27:22 +0000 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3c969fa8fd2so1495188b6e.1 for ; Tue, 07 May 2024 09:27:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715099237; x=1715704037; 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=JKfhOSoHE1VqyRhgB0xYInvnK6a8zz5LZUqmCULZe+M=; b=KXGTxsaiR2SG2u9wXZPScx4Q8l8YwrGR6hRFJLYDp/klwIr7UCagbD9KJiTUehp0X7 SOkeX5MvVX4t/I1S/8gNUY6jWH+r+r2480Pe65ojceMzhm9I+8rDp0BSbJB4W6ijufab +Bwd7IUqqM2QawYNEoTP62FpWeIVJeBa/Zsdo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715099237; x=1715704037; 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=JKfhOSoHE1VqyRhgB0xYInvnK6a8zz5LZUqmCULZe+M=; b=MVdoU5XzZTzrnn5JmTKiFdxFgrIiSSdHnBFTPmunR5nSydPcYCubHZH9laiwAoDK+p SmFegKqRut727EWKDR5/CVF9lxYS28dGy6iestwXQ0tqit9B2uFATy+NtdvkafMbjUci 4N/+mHHykFUVRP4Q8M78geBfU5RR3Q+rn2FlIke4s3xSrYw/ypmxwjW9jlc/ufmJwfQw fTeh5ce+6Rj4fkjORjaOFhL/XvnqZ0l3G/V4dK6ayo0cObzjGB+f6a5pe5ECCXGDKpwa LzO31lLI1omjMoatqtUShmYC7YI1scwffZGMJBzmm2GjzB3rymCBkXVViamXMtn9tvYk ujvQ== X-Forwarded-Encrypted: i=1; AJvYcCUC32QUA1oRk2HL1gIdKC+JMp253iDTQD1mA/Si896J1b6KxohqdaN9TdIXKCCjG7lO8ZB6UeChsAFYUSv+NOCLvi/Hkj2Tz0PSSE4lFDHkWkWe6WU= X-Gm-Message-State: AOJu0YwWSudQMGSvbNolANAoKTvPNsiGbIBgVl1+aGT9T13F44T0AHZd y2lJdVZ5yCWx93AIPYPym7eBTWwCw5+ydlHgCt3dlXu5TEZ+/P7RqsGtfla0RA== X-Google-Smtp-Source: AGHT+IH1n5rgepkFv+DmmmLViOZnDel/iUrOgLICLSZETgB3GeR4REJxlmdXw7sr6mA1VqvgfFFkzw== X-Received: by 2002:a05:6808:1990:b0:3c8:665e:1e57 with SMTP id 5614622812f47-3c9852c99fdmr89999b6e.25.1715099236642; Tue, 07 May 2024 09:27:16 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id hf23-20020a05622a609700b0043d1fc9b7d9sm4160597qtb.48.2024.05.07.09.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 09:27:16 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 07 May 2024 16:27:13 +0000 Subject: [PATCH v2 08/18] media: siano: Use flex arrays for sms_firmware MIME-Version: 1.0 Message-Id: <20240507-cocci-flexarray-v2-8-7aea262cf065@chromium.org> References: <20240507-cocci-flexarray-v2-0-7aea262cf065@chromium.org> In-Reply-To: <20240507-cocci-flexarray-v2-0-7aea262cf065@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-20240507_172719_805488_F306FFEC X-CRM114-Status: GOOD ( 13.05 ) 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