From mboxrd@z Thu Jan 1 00:00:00 1970 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 CF55FC636CD for ; Fri, 10 Feb 2023 06:10:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230285AbjBJGKI (ORCPT ); Fri, 10 Feb 2023 01:10:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229817AbjBJGKH (ORCPT ); Fri, 10 Feb 2023 01:10:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2EA538662; Thu, 9 Feb 2023 22:10:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4757F61CBE; Fri, 10 Feb 2023 06:10:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08284C433EF; Fri, 10 Feb 2023 06:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676009405; bh=jv4TbX6GFpuT5SBF7sQEqLkkaYY2p9ReJ7B17Deq/50=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eC3Tutfn6fZwjeZQLwzhFNTdDNgHmBWE17pEMrsIgueH6uJ+CvZbGb05nn66LBHAH I91eHhk8rX5z+HTBrnmKNU807f47ekjhISA5t39h4FnbryMIq+mI0hj+BzYink2mRM k/hmllC5y0rjWb4EI8PJhItDyN9ast37M2CEAa8i98AIXMOWWmToX6WA/bF7ZK4c6K 4Wp9VkgQ2LXdHJ+YdhCOkN8NcvfWH4Wp0+pi9VAd5UPPUm9gx1owCwm4SThcrAxDQI Dd0k+AiR7IVYLHoTzk1HD98I/sKtqJovAC9wAU4nDSpOvhWSzsXpiKM8F1QuC8RRBS vkicLzV/cZfcQ== Date: Fri, 10 Feb 2023 11:40:00 +0530 From: Vinod Koul To: Kees Cook Cc: Eugeniy Paltsev , dmaengine@vger.kernel.org, Andy Shevchenko , Sia Jee Heng , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] dmaengine: dw-axi-dmac: Do not dereference NULL structure Message-ID: References: <20230127223623.never.507-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230127223623.never.507-kees@kernel.org> Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org On 27-01-23, 14:36, Kees Cook wrote: > If "vdesc" is NULL, it cannot be used with vd_to_axi_desc(). Leave > "bytes" unchanged at 0. Seen under GCC 13 with -Warray-bounds: > > ../drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c: In function 'dma_chan_tx_status': > ../drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c:329:46: warning: array subscript 0 is outside array bounds of 'struct > virt_dma_desc[46116860184273879]' [-Warray-bounds=] > 329 | bytes = vd_to_axi_desc(vdesc)->length; > | ^~ > Applied, thanks -- ~Vinod