Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp108261rbe; Wed, 28 Feb 2024 13:55:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVkSdlxnCqPfNsLeCinwazErHDyn97/meEXb2DALmFjVI7gq1mLlRat9nqBc9k3pdr5EGqRR9sWusu8WQJCiuhhV/mB+8UGW6CehzULUw== X-Google-Smtp-Source: AGHT+IFxFwHfRMmEsFXKSSNqWb1PwNqTQ0dbbV+QYAHIniO/ZubNzEWXPa4YrZpdnjA3XxqlcxyI X-Received: by 2002:a17:902:e882:b0:1dc:c28c:fb92 with SMTP id w2-20020a170902e88200b001dcc28cfb92mr282072plg.33.1709157341696; Wed, 28 Feb 2024 13:55:41 -0800 (PST) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u14-20020a170903124e00b001dc8df92f1dsi4234130plh.234.2024.02.28.13.55.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 13:55:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85732-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=eL65Ly63; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-85732-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85732-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1F11AB29411 for ; Wed, 28 Feb 2024 21:37:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 539E870057; Wed, 28 Feb 2024 21:36:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="eL65Ly63" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7C1270030; Wed, 28 Feb 2024 21:36:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709156214; cv=none; b=eicFbG1g870D99iA6ULZoLEPzfdnKdGhkGM6Ku6bG6GdYOdRYm6y8r60uvrmCMX2FsY1rVc5jLCxOF+dJg7xZDabo+nniBcMsfDcwDs9Xda/OcPxfngYwJ3pyN4vJF4RBS6RbBUdnwLObiKY0UyWh95sOt6hcCZrLB4GtDZo/ZQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709156214; c=relaxed/simple; bh=8PJmKytlSsprccUo0R3nWiiL/iIqexJcXLdDR7loiNY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ee1Bviaoz55ZgkSzfH1SWipSZPh4ypAr4UFn6T8ITL0UGB5or04ElE6X0dlLhHQruqH1MK3fo8SrSptL2Ye3sQsOW8HNUPjBI/mCDN+F+RZPN0zjDdnBTRNaWqs2v7eQXx3AHcM0kSaajYg1QkGFdld6bqQTNVamFNYOmWmbXNY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=eL65Ly63; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709156213; x=1740692213; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=8PJmKytlSsprccUo0R3nWiiL/iIqexJcXLdDR7loiNY=; b=eL65Ly63fx4Yl7pAF6PDLA0r3v1SN7MARruIYDQxEuGA2tsDyCYr42pJ ndzqbPuKWn3U0YlbauAg5MZoYGa900F2biTgNljy8yRETFnkjEfaQf8M5 olX2HEpAer7d7B0XBrNueOTYfJ0WnVZRzPdD3uyID+GovZswZJhL/BRyF A03OTuXnWwyVTX4LT59KMrWEHToQaUOgtS/RuhIatRoop5pvmPzpU7nhP DGvfn1PeC9e/H8A9+8odx3vWM4lmtE0W53X5oPJ6DdMDSKdZck+r4VKkc k7FCdcat+UAe3ty2YmtOWJZo3K1mL/kvhvwseiimZ8twYgBnu9MJaLjTw w==; X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="7371106" X-IronPort-AV: E=Sophos;i="6.06,191,1705392000"; d="scan'208";a="7371106" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2024 13:36:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="913961929" X-IronPort-AV: E=Sophos;i="6.06,191,1705392000"; d="scan'208";a="913961929" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2024 13:36:47 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rfRbX-00000008VcR-2Fpg; Wed, 28 Feb 2024 23:36:43 +0200 Date: Wed, 28 Feb 2024 23:36:43 +0200 From: Andy Shevchenko To: David Lechner Cc: Vinod Koul , Linus Walleij , Jonathan Cameron , Mark Brown , Kees Cook , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-spi@vger.kernel.org, netdev@vger.kernel.org, linux-hardening@vger.kernel.org, Jonathan Cameron , Lars-Peter Clausen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Gustavo A. R. Silva" Subject: Re: [PATCH v4 3/8] iio: core: NULLify private pointer when there is no private data Message-ID: References: <20240228204919.3680786-1-andriy.shevchenko@linux.intel.com> <20240228204919.3680786-4-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Wed, Feb 28, 2024 at 03:06:42PM -0600, David Lechner wrote: > On Wed, Feb 28, 2024 at 2:50 PM Andy Shevchenko > wrote: .. > > - indio_dev->priv = (char *)iio_dev_opaque + > > - ALIGN(sizeof(struct iio_dev_opaque), IIO_DMA_MINALIGN); > > + > > + if (sizeof_priv) > > + indio_dev->priv = (char *)iio_dev_opaque + > > + ALIGN(sizeof(struct iio_dev_opaque), IIO_DMA_MINALIGN); > > + else > > + indio_dev->priv = NULL; > > Do we actually need the else branch here since we use kzalloc() and > therefore indio_dev->priv should already be NULL? This is more robust, but I'm okay to drop this. Up to Jonathan. -- With Best Regards, Andy Shevchenko