Received: by 10.223.185.116 with SMTP id b49csp3588529wrg; Tue, 6 Mar 2018 01:24:28 -0800 (PST) X-Google-Smtp-Source: AG47ELthgcQK8xkZuIx2GAOsiBJOZgvVMI/4xNgv8WjntwFV4SsstVwc8ke8RnW7vYo3RSqX5ciy X-Received: by 10.99.180.77 with SMTP id n13mr14483387pgu.361.1520328268857; Tue, 06 Mar 2018 01:24:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520328268; cv=none; d=google.com; s=arc-20160816; b=U83KL5V7Ki7RjsOwHU6VwjI/15Q/L7zFJVmf/wPpr8t98NcqTdRaV/7/0+EH0W6NL+ HU6zrwE2IQBaL3gDNnhuwF53CAXjGtTiuvFs2ctTyCvkBdk/HXISZGeKioSmoRjdXA9m A/BtRwH6ewvaGzXn9w3fLUHmrqrkAYtn8hy6NXFVjbDRmSZhrwPaHiFg1/vK/jrN00u5 Rdc88lpeaX1epeQ2QWCUEW/lUMAsj7v726zsBeUPaUhX6jMOqph8W8h3/gAoC62zoeWJ 2/8+nW44C8OcSAWi1Fh+2TNuPALLchVTDtwqvZ41a45KzB+RnDNQgY8gRbRCDjLMlwHi BIbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:arc-authentication-results; bh=Kuq5msHRGJleosj3fvA61zBtjHTMHDkHqKHY2GU+e/Y=; b=XhrTew/sKXU+VK0n9JEOmq9eiQPc2SPqnHTNvGDdJTs5/IHQEj64OJnTO6QwuPJfAG vwRc1Djaqx4d7PUw3gnDB3FZDtnXhKHiQHoA6kMUDh/QfYFc/hg0GZySaqeFBQmncRCQ D4Rqs+rPZ8/01kYXvWJBVMIeBpm1qThS2rNGrU+qOkNd0YvbozlQORJDSVEFZqvPgCJp rHHVafh10b2VkSCS8rTkYf/O5p8ZpqZn5jPxI5gqiP0/5CA0uY+LMgLJ7rcU42vcLu0U uhttTtb8GE6cu/mrTHc0f7pQDaAD1/TYZ2D2wL5/MuNaPAAgwnaw7yStD4YGEA8o5pua rYeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92-v6si4832954plw.562.2018.03.06.01.24.14; Tue, 06 Mar 2018 01:24:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932594AbeCFJXX (ORCPT + 99 others); Tue, 6 Mar 2018 04:23:23 -0500 Received: from mout.perfora.net ([74.208.4.197]:50489 "EHLO mout.perfora.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750912AbeCFJXU (ORCPT ); Tue, 6 Mar 2018 04:23:20 -0500 Received: from mail-pl0-f53.google.com ([209.85.160.53]) by mrelay.perfora.net (mreueus001 [74.208.5.2]) with ESMTPSA (Nemesis) id 0MhCAZ-1f6WyH0hhx-00MJHx for ; Tue, 06 Mar 2018 10:23:20 +0100 Received: by mail-pl0-f53.google.com with SMTP id f23-v6so11525600plr.10 for ; Tue, 06 Mar 2018 01:23:20 -0800 (PST) X-Gm-Message-State: APf1xPDe8UaT8c8atiL7dJv4YGmdHyNDkQopQLuJ87dSJHHOWbZoTThf t8h1nHi/hl94FqYPosS7XggEVaIj0nB4ISCbQd0= X-Received: by 2002:a17:902:720b:: with SMTP id ba11-v6mr16400202plb.148.1520328199399; Tue, 06 Mar 2018 01:23:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.166.12 with HTTP; Tue, 6 Mar 2018 01:23:18 -0800 (PST) In-Reply-To: <20180301162130.GB15087@kroah.com> References: <20180224075835.11618-1-quytelda@tamalin.org> <20180224075835.11618-2-quytelda@tamalin.org> <20180301162130.GB15087@kroah.com> From: Quytelda Kahja Date: Tue, 6 Mar 2018 01:23:18 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/4] staging: most: Replace calls to BUG_ON() with WARN_ONCE() and return. To: Greg KH Cc: christian.gromm@microchip.com, devel@driverdev.osuosl.org, Michael.Fabry@microchip.com, chris@engineersdelight.de, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K0:hDXP1RrlbZjRKqeU56u9wYtKa6vLCQNgyGLLohfVa3tcd+UTOkc irfKTmnqRJMui1OVVG7H2n50ZScVZBjUw4viUIjH3kBiIAxHz49iImVnmZnKq2i+vHLuY+r w2OEUMtcUZDkcf4vzqar6vb2eeXaRm2XRdVvkAVhj/w57hQsNfErew6l2hjuQf+kmfwLzAr XKoXMI7uSa6RrunutGjKA== X-UI-Out-Filterresults: notjunk:1;V01:K0:YevKD3b8Dgs=:XDBi0uoS1Qvysj15tdEeW3 fhWN5uujPXT+zg2ia1AHZcdmwHYJe4rmV7Ub6pHBsrNDs1sZuA+bumhocJRVpJG6HeEC39EXE +2OgRrxRH7Vlyiwwx9IOtCe0YKOWK0CnLrkMTMouh8mohIOmDbT7ohvl0KKpALpRZk0ycqVVo 7aP78w/phkQZ73kdiRvn7nK1N1PwDc+Aw335yOZ62Y6H5uwLJU2jg/kL/QHw4+tult/noFQGy TMHcbF/ERl8DVgY4C0rT2oHdY+MMTgZFjjPh1rQWxx2gNDXckpvluYGPaqcHnliMG8IknN741 ZaGz9r0AOLPoWuR+0M+ngtjqqBgzHB15IX6yCgSFYsQAD/UgOXyxWLfiIDIsTGnJT25VWx4iG axP4whnksZv2kB6R4p/x0eCaoPRmY/lTIF6NzCby5wu52uD1tj2bM/lIdTdDnNQ2WqpP8GEUr Q0aDI8nvi7sFwokvdi2IKAxtFUrhJfpPYg2JvuH5asGQXRSAB7/LzONYE5rerqmE5eDxDkN+Q AskpdxiAJY1tChu1WX57MWbCWLI0Ycr5KcZpmjRmFSqGAusaBbjDiJDmsbrcQ3Kg71BYG9mBu SQspqZLZP6HzwyoKEIQJZfjLqESXGKkyvVlfN/TS0xQUfuR0dnSVeE6n9SpULXQkfJZJForob 4+UDVIiYe1L2V5WW4L5I+yVDcR8IoU98yxzQGh+tqmWK0tkvhEf+LkIJgJ98NqKHGtZ/LJpXO mxVDUVZqdaMUKMMd1vi2hiUt/GFh7rnqU7bCVZ6+ETla9aNQDyVGDPpxb+w= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Are you sure this will work? Well, my goal was just to replace the code that could crash the kernel and let somebody with a better understanding of this particular driver write the recovery code, if necessary. It seemed from context that the BUG_ON() calls were being used like assert() though, so I assumed there wasn't really much recovery to be made from that problem. If you feel this doesn't improve the behavior of the driver, just drop the patch. Thank you, Quytelda Kahja On Thu, Mar 1, 2018 at 8:21 AM, Greg KH wrote: > On Fri, Feb 23, 2018 at 11:58:33PM -0800, Quytelda Kahja wrote: >> Replace calls to BUG_ON() used to check for NULL pointers with WARN_ONCE() >> followed by a return. > > Are you sure this will work? > >> >> Signed-off-by: Quytelda Kahja >> --- >> drivers/staging/most/core.c | 13 ++++++++++--- >> 1 file changed, 10 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c >> index 18157dd80324..3f65390a6e17 100644 >> --- a/drivers/staging/most/core.c >> +++ b/drivers/staging/most/core.c >> @@ -916,7 +916,11 @@ static void arm_mbo(struct mbo *mbo) >> unsigned long flags; >> struct most_channel *c; >> >> - BUG_ON((!mbo) || (!mbo->context)); >> + if (WARN_ONCE(!mbo || !mbo->context, >> + "Bad mbo or missing channel reference.\n")) { >> + return; > > How is the code supposed to recover from this major problem? > >> + } >> + >> c = mbo->context; >> >> if (c->is_poisoned) { >> @@ -1001,7 +1005,7 @@ static int arm_mbo_chain(struct most_channel *c, int dir, >> void most_submit_mbo(struct mbo *mbo) >> { >> if (WARN_ONCE(!mbo || !mbo->context, >> - "bad mbo or missing channel reference\n")) >> + "Bad mbo or missing channel reference.\n")) > > You did something different here that you did not describe in your > changelog :( > > thanks, > > greg k-h