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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 107D2CEFC36 for ; Tue, 8 Oct 2024 17:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RwH4CR5GV9LTmZgX7n/SjHZ72MbqPS7cjq3uPr6rEz4=; b=CMSWzyOESmYgaAuLL5ChSe8+O7 NKdA2uun6NECudcSycDYg8uKwMc4++64ya3y1whLZsBy+6s0u+3yirv89tz15raq1yR2IKM0vnWWX OlNNvl1QSEYYcDG3jRHv0cTtB3rxGwhBHhG2+xj50VYYNmflck7ZQBAMPyukWaaKBZykQIudAiua8 PLgSlU5ZkwSVMjRWD7bHalLZ9yisWUwViMvhUx8O0cHCzZwGSYBTeGRit4IW+8xoDfYOhVVWyTVLV oVyHm3nQu91TTzbxxJ0F3mBS1wcyX1Kix0B6P/0bYuckixM+iQgNRdPz43LDmDat59keeCiYG8tK4 Yfy9jANw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syDq6-00000006cj8-1ItI; Tue, 08 Oct 2024 17:17:38 +0000 Received: from mgamail.intel.com ([192.198.163.14]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syDon-00000006cWu-29L7 for linux-arm-kernel@lists.infradead.org; Tue, 08 Oct 2024 17:16:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728407778; x=1759943778; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=HiDTiaw0GrTH+FU7jhEUSpJUXkK0emE/bQNQSR8MGes=; b=XEHcL+U6s4vvaEZvPiYVzuhZKPPFDC9UudqUtGWoA/H386GJOc6rGZ3G 3paF8DpltLal02A0IeaF6+gyWfsDgO+VTbdqm3lJHrHuWY/eOhessI3wT XwAYM1xFzXAmkSGL/t6IGFoRgWmTNRc6TFyH0u54WnI7ai/Hzk4ISmaWT FsANrUCJbJaNlUYaLGS4N7Q7J5PomVEUmZR8lu0JnFeVDHk5KhY1pO9sn OftEd0gb8qryASr8i0nR/rh1DGrz3Q0gmuiUztY/6Bg4Q69bBzzprOqqP tGxxLFAfS8ve6odZI0VxAcCzcwyjsfTD9ACSLq2Ab/kLey4NGBTD2A3JY A==; X-CSE-ConnectionGUID: /PArls3dRgGvWpobSyGquw== X-CSE-MsgGUID: ld0dBZh0SQCoh2rjGoS4Gw== X-IronPort-AV: E=McAfee;i="6700,10204,11219"; a="27787908" X-IronPort-AV: E=Sophos;i="6.11,187,1725346800"; d="scan'208";a="27787908" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2024 10:16:17 -0700 X-CSE-ConnectionGUID: RQU2oqNyRc6cROB7iTkWgQ== X-CSE-MsgGUID: O9dU591mQnmuqiPzI8fttA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,187,1725346800"; d="scan'208";a="75591497" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa007.fm.intel.com with ESMTP; 08 Oct 2024 10:16:14 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DDA0C20F; Tue, 08 Oct 2024 20:16:12 +0300 (EEST) Date: Tue, 8 Oct 2024 20:16:12 +0300 From: Andy Shevchenko To: Frank Li Cc: Vinod Koul , Paul Cercueil , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Subject: Re: [PATCH v1 3/4] dmaengine: Add a comment on why it's okay when kasprintf() fails Message-ID: References: <20241007150852.2183722-1-andriy.shevchenko@linux.intel.com> <20241007150852.2183722-4-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241008_101617_597057_77EAC508 X-CRM114-Status: GOOD ( 18.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Oct 07, 2024 at 11:51:14AM -0400, Frank Li wrote: > On Mon, Oct 07, 2024 at 06:06:47PM +0300, Andy Shevchenko wrote: > > In dma_request_chan() one of the kasprintf() call is not checked > > against NULL. This is completely fine right now, but make others > > aware of this aspect by adding a comment. > > suggest: > > Add comment in dma_request_chan() to clarify kasprintf() missing return > value check and it is correct funcationaly. Sure, thanks. ... > > #ifdef CONFIG_DEBUG_FS > > - chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev), > > - name); > > + chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev), name); > > + /* No functional issue if it fails, users are supposed to test before use */ > > comments should above chan->dbg_client_name ... It's placed exactly there on purpose. Because it explains > No funcational issue if it is NULL because user always test it before use. I think my is better because it reveals the actual issue, ideally users must not rely on that and the code here should assign a valid pointer. The problem is that the code paths are a bit twisted and I only can come up with this comment _for now_. Semantically this change is a band-aid (and not good), but at least it describes current (broken) desing. -- With Best Regards, Andy Shevchenko