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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 3C24EECAAA1 for ; Fri, 9 Sep 2022 06:42:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 279E210E4C8; Fri, 9 Sep 2022 06:42:20 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D0FD10E422; Fri, 9 Sep 2022 06:42:12 +0000 (UTC) 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 E41AB61E57; Fri, 9 Sep 2022 06:42:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED877C433C1; Fri, 9 Sep 2022 06:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662705731; bh=++xznS1nBkmvicv1/ui2g1o12ZcNq1ryyoqF5tbCGSg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=07uNW1IQVUhhjfs8AZE+0ZcLOBlPkYbprpu7KFHx1/Py1y0lZqX/NDnects5ZAUTa LPkDjlxnMKdh4IL982cWLylkcrlz9t7NHaJ2deJSsZl0fJfdhahpCj8gJ2TXX+l/fm ycTYeoeu3G5eIbVPIhd14kz1r49NveC1PgiV/YYE= Date: Fri, 9 Sep 2022 08:42:08 +0200 From: Greg Kroah-Hartman To: "Winkler, Tomas" Subject: Re: [PATCH v4 05/15] mei: pxp: add command streamer API to the PXP driver Message-ID: References: <20220909001612.728451-1-daniele.ceraolospurio@intel.com> <20220909001612.728451-6-daniele.ceraolospurio@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "intel-gfx@lists.freedesktop.org" , "Ceraolo Spurio, Daniele" , "Teres Alexis, Alan Previn" , "Lubart, Vitaly" , "dri-devel@lists.freedesktop.org" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Sep 09, 2022 at 06:38:33AM +0000, Winkler, Tomas wrote: > > > > On Thu, Sep 08, 2022 at 05:16:02PM -0700, Daniele Ceraolo Spurio wrote: > > > +static ssize_t mei_pxp_gsc_command(struct device *dev, u8 client_id, > > u32 fence_id, > > > + struct scatterlist *sg_in, size_t total_in_len, > > > + struct scatterlist *sg_out) > > > +{ > > > + struct mei_cl_device *cldev; > > > + > > > + if (!dev || !sg_in || !sg_out) > > > + return -EINVAL; > > > > How can these ever be NULL? Doesn't the core control this, so why would > > that happen? > This is any interface function between modules, I think it is not healthy to take assumptions here about how caller > behaves, this is not an inner functions. This is important even for catching programmatical mistakes. It is a static function being called from a framework. Enforce this in the framework, don't sprinkle this stuff everywhere, the kernel is NOT defensive about internal users like this otherwise it will overwhelm every function call. thanks, greg k-h