Received: by 10.223.185.116 with SMTP id b49csp3607225wrg; Tue, 6 Mar 2018 01:49:10 -0800 (PST) X-Google-Smtp-Source: AG47ELs+I+du4GDulpfzb8NJ1dVjg4tiWM/OmHx9suZRcm2OruxMVBzWn6viP2QV84Gz6uAhrgxk X-Received: by 2002:a17:902:b58d:: with SMTP id a13-v6mr16529550pls.123.1520329750713; Tue, 06 Mar 2018 01:49:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520329750; cv=none; d=google.com; s=arc-20160816; b=NvF5qfPte9U5bUo6rIGMXDbnvEqbkjSMSoI2Yjc59S06SRudtCJ69lcTFj8lwb4SnQ rDlT8BFw69rSLXFTYk04MCdhSF1A30gRd+48qvZMWafYXBW25O2NvmoPFAWW0OuhxOkZ kTOqjHP7hUr/GTqWBiCs1naexjv4p8T04L3lTszSUoXmfvoBVcWJigFO7DkIfbjyQ8Bk xm8P5lFDNF3wGJs8CyOVL6DhTCpp48BZ6GkqrraYZZrAbY5kn8WT/QOwkGMA8ZFVK24e CyzVcIbCcEpkOaf0LaMLYjd+BnKSMeYjPrwSOvS9xSN/L9TpWax6XBlUcvIei4a/Raf7 oPvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Tzk8OZQbcVUmFcnfytazyLv7HugpMU9QBcwBwrCoSbo=; b=gL5fQs5KEDYY38el28Sio6j9LqGZueQd6ude5rUNRLNXBsCfRinS9VnacjOzhCMtIU NulyF8LwQGPhPJ71Y5S2exNDumngF3D33NYdubQdBKBCubslWom55aR+zHiw6IdxW40U WQ5ZNNqQOsrzSmLHZUytCMvDocaLcMWBlESuSdBrkHPHq8GnDr9gVUmWTO3DSNd0ovUF 2YWn7no+SAdzj4QdHooSuFXG8fRZGpJ4ToNSjZ77rigE8ga6evkC7urN3TpRn5hxnVXG g3bv3mHXFWiHNq1aFPBhoV8jvqlnCbNPI/L/OSFFFZnGde/Vcci5BqNVSYuyDQ0eCFJL lfdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=SYGXal/f; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v22si4081896pgo.107.2018.03.06.01.48.56; Tue, 06 Mar 2018 01:49:10 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=SYGXal/f; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753208AbeCFJrt (ORCPT + 99 others); Tue, 6 Mar 2018 04:47:49 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:45542 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750819AbeCFJrr (ORCPT ); Tue, 6 Mar 2018 04:47:47 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w269ktPT171233; Tue, 6 Mar 2018 09:47:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=Tzk8OZQbcVUmFcnfytazyLv7HugpMU9QBcwBwrCoSbo=; b=SYGXal/fzBQKOHKrXUFM/4gf9j/TV8afo9qFGN/rNJOBAvQ6BR7KOKOhkm2ZBjj6LFGx nd6vrqna9jyI3xBHbqI/6cZa3x/fCAJTpjTwp+M6XMpPSS/kIQXpcw0rCBF9I8VSACy/ hXtC2Mx58Ue+g6KA7kj5ToUjIGbpJe1Sy6YZun954FW/hwJ26ByyDnJrLqZzviaqZPyP u0F9Ybmquo2WCD3joabT5parxd/gYgTnkMA/hHM1f4NU31/130IOoBcWKi6N9d7YXuSA nHMJKVUR7UUVFaRQFo/0r9knyuyfeVU5ZBP5oFB+qxMqexU/vGVol+zsNKv3XTgCr35b gQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2ghr4cr99j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 09:47:40 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w269lcRm006498 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 09:47:38 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w269la2N020807; Tue, 6 Mar 2018 09:47:36 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 06 Mar 2018 01:47:35 -0800 Date: Tue, 6 Mar 2018 12:47:28 +0300 From: Dan Carpenter To: Quytelda Kahja Cc: Greg KH , devel@driverdev.osuosl.org, christian.gromm@microchip.com, chris@engineersdelight.de, linux-kernel@vger.kernel.org, Michael.Fabry@microchip.com Subject: Re: [PATCH 2/4] staging: most: Replace calls to BUG_ON() with WARN_ONCE() and return. Message-ID: <20180306094728.xbhamhpwdphv6kju@mwanda> References: <20180224075835.11618-1-quytelda@tamalin.org> <20180224075835.11618-2-quytelda@tamalin.org> <20180301162130.GB15087@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8823 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=433 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803060113 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 06, 2018 at 01:23:18AM -0800, Quytelda Kahja wrote: > > 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. > mbo is always non-NULL just from a quick glance. I didn't look hard enough to verify that mbo->context was OK. It's generally best to just check the callers and delete these. Say you have a BUG_ON() then that prevents memory corruption (not an issue here) but it makes debugging hard. But if you just have a NULL dereference it probably kills the driver but you get an Oops which you can debug. So a NULL dereference is normally better than a BUG_ON(). regards, dan carpenter