Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1815482ybk; Mon, 11 May 2020 05:05:55 -0700 (PDT) X-Google-Smtp-Source: APiQypKnM/COrKU/fXBnrcB1zSVsVULqXdoWxa7bE7+Qe2XZuZjQyHUemRYgHFCb7Fnqh6I2fUN6 X-Received: by 2002:a05:6402:1b08:: with SMTP id by8mr12837950edb.286.1589198755701; Mon, 11 May 2020 05:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589198755; cv=none; d=google.com; s=arc-20160816; b=Pyw/Af1rM23klslxs/6pym8+BK8gNl9ie4jNCU7K2SO+SOVphv3zbjF+GH8T5NuUjn e1qmmXvC90+U3WfHYlACTum5tgCfiJ1btKFmdZQafhE4+lBBdd1ZIIF1h6vCs3zN+o8O 8jKC7e8f3b6P5F8ekPPMLaXZv3quPnuYBWAwynsqQxQqY4oEkegBlfk5y1kNjNLbKuHF 0sk28+ee6cA0VBsAiDLjYsT68WYuRW3ZNAxbAJQclgCPZmVquyFsoUWFaJToDXoDiS2V E9xij/+89jUBvdoO0oslAjXohUP4LdQ0XkxwXh+x1Yaue+KpAsUmqzothbymuFLXK9hv ueHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dmarc-filter :dkim-signature; bh=Jmzs0E9+O1pVr2sYnBpw6y1FlvUw8+1YyjOY/kdYnfg=; b=cq05fiZWrDIDF6nKNLfrjUaBdzxfZOM2JJfBgeKltu8jyVid2SQJ8BPQrspFdXIqPF LUKh/TqxOJh6aZVpTebLdImDtX0+3EZG/Dy8VrOKTNw4syVQwHBY3kcP/VETpTKBfiqT yO4o7eocHIlfIlcPNqaWI09c+ZXgurLQmUMeJaR/S+2iuJNTfEHa9DSeF6Ec8ZZ/3gTz oZt0JEh6WmY5/C480wer7BDtBs89ZgcpsIPmas6P659ZrcfJGc39MvN0xY+Dzh0He1PG 9AKDOVF7rvV8FRycfD3p9Rpz2i3ACeCmgBuobw9ig3PjaaGqPVq+XgJdtZ/4hln/XPvF HM7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Vv0khaGW; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si2002687ejr.274.2020.05.11.05.05.14; Mon, 11 May 2020 05:05:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Vv0khaGW; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729791AbgEKMFJ (ORCPT + 99 others); Mon, 11 May 2020 08:05:09 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:32296 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729573AbgEKMFI (ORCPT ); Mon, 11 May 2020 08:05:08 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1589198708; h=Content-Type: MIME-Version: Message-ID: In-Reply-To: Date: References: Subject: Cc: To: From: Sender; bh=Jmzs0E9+O1pVr2sYnBpw6y1FlvUw8+1YyjOY/kdYnfg=; b=Vv0khaGW9ocUPj51J11eIHVrmwREP5yHIcU3kRnsJHaTSNBVGzoDodsszAikYy7Ggw5oAvkr 27+9sQ6RGOrBnyhViC2pv7/6IypTHZxdU9hH3eRayELi6uenpX7a5xoGBxg21anm5E1nDXc+ 0EJdKcoa1CN6eZdLKCiLxeqhzkE= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5eb93f73.7fb15c6e5c00-smtp-out-n04; Mon, 11 May 2020 12:05:07 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 714F3C433BA; Mon, 11 May 2020 12:05:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=ham autolearn_force=no version=3.4.0 Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 94199C433F2; Mon, 11 May 2020 12:05:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 94199C433F2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: Arnd Bergmann Cc: Maharaja Kennadyrajan , "David S. Miller" , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 2/2] ath10k: fix ath10k_pci struct layout References: <20200509120707.188595-1-arnd@arndb.de> <20200509120707.188595-2-arnd@arndb.de> Date: Mon, 11 May 2020 15:05:01 +0300 In-Reply-To: <20200509120707.188595-2-arnd@arndb.de> (Arnd Bergmann's message of "Sat, 9 May 2020 14:06:33 +0200") Message-ID: <87v9l24qz6.fsf@kamboji.qca.qualcomm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Arnd Bergmann writes: > gcc-10 correctly points out a bug with a zero-length array in > struct ath10k_pci: > > drivers/net/wireless/ath/ath10k/ahb.c: In function 'ath10k_ahb_remove': > drivers/net/wireless/ath/ath10k/ahb.c:30:9: error: array subscript 0 > is outside the bounds of an interior zero-length array 'struct > ath10k_ahb[0]' [-Werror=zero-length-bounds] > 30 | return &((struct ath10k_pci *)ar->drv_priv)->ahb[0]; > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > In file included from drivers/net/wireless/ath/ath10k/ahb.c:13: > drivers/net/wireless/ath/ath10k/pci.h:185:20: note: while referencing 'ahb' > 185 | struct ath10k_ahb ahb[0]; > | ^~~ > > The last addition to the struct ignored the comments and added > new members behind the array that must remain last. > > Change it to a flexible-array member and move it last again to > make it work correctly, prevent the same thing from happening > again (all compilers warn about flexible-array members in the > middle of a struct) and get it to build without warnings. Very good find, thanks! This bug would cause all sort of strange memory corruption issues. -- https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches