Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp895661pxb; Tue, 1 Feb 2022 12:40:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPqzZpyFFhSZHVCxmOww6aT6jHlcFPTDKoCsMKvceaIE8tOgwIMpq8OWnjKKFUlVkCI28j X-Received: by 2002:a17:902:da8f:: with SMTP id j15mr27095950plx.63.1643748004858; Tue, 01 Feb 2022 12:40:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643748004; cv=none; d=google.com; s=arc-20160816; b=w3QDWPnUWCIeBAs06BRJKduCfOCpv1AAD/7e27kC/jTs0yoIENEZaI+YjCTVH6twsE pzQ2WQcAX3mq1mALxh16ElUh0F88RYcqfp2g/hkIdCi2xldC/fpJV8+94e4o4YECfZro HIOZvMgah92PHfanqtuhY6JqCmXchfmBMQKtH+jvdysQvrqXRpmxoLsyfVEfpjwcEyZ5 R5Islw4KoEYyRmd41TWWgyDCxhpdzcniuGZk+AfaciW/Y1UKEUbEAMGYbADHKiFyGz3b jyk/R2HTQsju2DzlObE9hXxAftdI/nmxHJub2QTZauqxR8USyLKP/YFo8TKC3nS1uK7c oB1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Pm1Zd1SLdQWcFVqaiFCxjo74p0wMJF+nZ63y4UHFOKk=; b=KsqXzKkO0FhMUrzfeFTmzdJUQy6oEfF094FK+nRQ3uKnyuG5muqMGjyqqpXe00eXsc sT1gptK6som/k1gHz2NTZeqVmU1SdUEiy/NS92KBacmjz3RjnLNM2qxgjVwOSjTTzrlx juO72C0K8fUKMHO5gmjAYIIXkOEyOG9R3Fqi2qCUCeYY3NQnKx+qULUjgRDocNGQ9uXs iE0MR8Aki510fDCEea1SaUNofvVpn+tW7cvT1xO70WoHUVp4xd4J4aCPPWe6W1Y+D1Kd DQ7NJSa+kifY5ymfH46crRB0tK7gdw6IOX/HYA4vJuvOZYFN0nPTMfxED8G4HhXhRR6W sCaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bCGy+cUs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n4si20566860plh.396.2022.02.01.12.39.53; Tue, 01 Feb 2022 12:40:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bCGy+cUs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377500AbiAaNzJ (ORCPT + 99 others); Mon, 31 Jan 2022 08:55:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243076AbiAaNzI (ORCPT ); Mon, 31 Jan 2022 08:55:08 -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 4C47AC061714; Mon, 31 Jan 2022 05:55:08 -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 E15C7612C8; Mon, 31 Jan 2022 13:55:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA89BC340EE; Mon, 31 Jan 2022 13:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643637307; bh=Mux+ePrY92AdNvLzvqVcgpb98PfbvNDN5o5jwmjyfww=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bCGy+cUsKVh1qxUrE4zCpjye+OJAvX7e3cTfdxgTndfpBEZz+UwzMFXmJvXr5aiQy SuIxQWsSjykVcYiw59O41KScLb862vSFn98HsWXbJXsJ/ANaVb5/xO5xHN70SQkTBO DKPJmvLCJYfzgJOi58r2C58pLlptCOs8LolavgwUS+Lvkoclal/EzQKfPzIy+1ZYMz UzypcFTal4H9gH0YHh+Ha4n01PS8Gf3RLbj4GXhKIk8WyzROpPaxwWvdXeUA22zaQX 0km23LsI4JZX/OwphBxMAORiU4Y4RIHo2AUr0X1xiguTWQdycyIlkm/tlbHck8F6TY 0JRZ0yiXxWyDg== Date: Mon, 31 Jan 2022 13:55:00 +0000 From: Mark Brown To: Pratyush Yadav Cc: Tudor Ambarus , Michael Walle , Miquel Raynal , Takahiro Kuwano , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] spi: spi-mem: check if data buffers are on stack Message-ID: References: <20220131114508.1028306-1-p.yadav@ti.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dgw4aAEj6xocjt/W" Content-Disposition: inline In-Reply-To: <20220131114508.1028306-1-p.yadav@ti.com> X-Cookie: I will never lie to you. Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --dgw4aAEj6xocjt/W Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jan 31, 2022 at 05:15:08PM +0530, Pratyush Yadav wrote: > The buffers passed in the data phase must be DMA-able. Programmers often > don't realise this requirement and pass in buffers that reside on the > stack. This can be hard to spot when reviewing code. Reject ops if their > data buffer is on the stack to avoid this. Acked-by: Mark Brown > + /* Buffers must be DMA-able. */ > + if (op->data.dir == SPI_MEM_DATA_IN && > + object_is_on_stack(op->data.buf.in)) Might be worth a WARN_ON_ONCE() for debuggability? --dgw4aAEj6xocjt/W Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmH36jMACgkQJNaLcl1U h9Do6Af+PYxmL6o8QTkbuSMNCf4zLsOLWsjug+Pzqn02yk4lNTbwV29h3+FEqewh trvMCVQgaMabgUOf/9hZhlYOJHod52b77dQI7iBolONua4wUPqHsNtO+p9FP7V46 gjUkTp54ArBKRRI8rlP/IpJy9ZAlzEEZEeXzGn/FZtw+Sdh8RDsFPSiB2X265XQG dYLDlWfbrKc/2rSAoi46iZY9J9lcm86V44LAdJ1GoLXUf/esHiOtLftGUA+9xGb+ MoOIrMhQ1+AtnAx6fdg0DwD6aKNBFT7gCVqUOvteLnFGGCYKTMSF1OAuywY+4CSj n1ri3jkVecHB15q9WpPtuVniim+7fA== =ywN3 -----END PGP SIGNATURE----- --dgw4aAEj6xocjt/W--