From patchwork Thu Apr 30 21:30:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11521675 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1BA9681 for ; Thu, 30 Apr 2020 21:33:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0CEFA214D8 for ; Thu, 30 Apr 2020 21:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728057AbgD3Vds (ORCPT ); Thu, 30 Apr 2020 17:33:48 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:40667 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726752AbgD3Vdr (ORCPT ); Thu, 30 Apr 2020 17:33:47 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1M6DnM-1jWUnr12TI-006ihr; Thu, 30 Apr 2020 23:33:23 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Kyungmin Park , Andrzej Hajda , Mauro Carvalho Chehab , "Gustavo A. R. Silva" , Sylwester Nawrocki Cc: Arnd Bergmann , Mauro Carvalho Chehab , Wolfram Sang , Kieran Bingham , linux-media@vger.kernel.org Subject: [PATCH 12/15] media: s5k5baf: avoid gcc-10 zero-length-bounds warning Date: Thu, 30 Apr 2020 23:30:54 +0200 Message-Id: <20200430213101.135134-13-arnd@arndb.de> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200430213101.135134-1-arnd@arndb.de> References: <20200430213101.135134-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:KLa+rD8CoNAYi1ja+1cMv6oVML/pmJteDWSg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G90QQ52Z1byMTfYPposxX5o2U/o80KdG0= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org gcc-10 warns about accessing a zero-length struct member: drivers/media/i2c/s5k5baf.c: In function 's5k5baf_load_setfile': drivers/media/i2c/s5k5baf.c:390:13: warning: array subscript 65535 is outside the bounds of an interior zero-length array 'struct [0]' [-Wzero-length-bounds] 390 | if (f->seq[i].offset + d <= end) | ~~~~~~^~~ This should really be a flexible-array member, but the structure already has one. I experimentally confirmed that swapping the two avoids the warning, as the 'data[]' array is not accessed like this. Fixes: 3ba225b506a2 ("treewide: Replace zero-length array with flexible-array member") Fixes: 7d459937dc09 ("[media] Add driver for Samsung S5K5BAF camera sensor") Signed-off-by: Arnd Bergmann --- drivers/media/i2c/s5k5baf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c index 42584a088273..0b1ddedcf7dc 100644 --- a/drivers/media/i2c/s5k5baf.c +++ b/drivers/media/i2c/s5k5baf.c @@ -277,11 +277,11 @@ enum { struct s5k5baf_fw { u16 count; + u16 data[0]; struct { u16 id; u16 offset; - } seq[0]; - u16 data[]; + } seq[]; }; struct s5k5baf {