From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f71.google.com (mail-pl0-f71.google.com [209.85.160.71]) by kanga.kvack.org (Postfix) with ESMTP id 8B7E66B0003 for ; Wed, 30 May 2018 11:13:29 -0400 (EDT) Received: by mail-pl0-f71.google.com with SMTP id o23-v6so11416281pll.12 for ; Wed, 30 May 2018 08:13:29 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id k12-v6si6482139pgp.561.2018.05.30.08.13.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 08:13:28 -0700 (PDT) Date: Wed, 30 May 2018 08:13:27 -0700 From: Matthew Wilcox Subject: Re: [PATCH] mm: dmapool: Check the dma pool name Message-ID: <20180530151327.GA13951@bombadil.infradead.org> References: <59623b15001e5a20ac32b1a393db88722be2e718.1527679621.git.baolin.wang@linaro.org> <20180530120133.GC17450@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Baolin Wang Cc: linux-mm@kvack.org, LKML , Arnd Bergmann , Mark Brown On Wed, May 30, 2018 at 08:14:09PM +0800, Baolin Wang wrote: > On 30 May 2018 at 20:01, Matthew Wilcox wrote: > > On Wed, May 30, 2018 at 07:28:43PM +0800, Baolin Wang wrote: > >> It will be crash if we pass one NULL name when creating one dma pool, > >> so we should check the passing name when copy it to dma pool. > > > > NAK. Crashing is the appropriate thing to do. Fix the caller to not > > pass NULL. > > > > If you permit NULL to be passed then you're inviting crashes or just > > bad reporting later when pool->name is printed. > > I think it just prints one NULL pool name. Sometimes the device > doesn't care the dma pool names, so I think we can make code more > solid to valid the passing parameters like other code does. > Or can we add check to return NULL when the passing name is NULL > instead of crashing the kernel? Thanks. No. Fix your driver.