Received: by 10.213.65.68 with SMTP id h4csp1718627imn; Mon, 19 Mar 2018 11:20:48 -0700 (PDT) X-Google-Smtp-Source: AG47ELt/+ySrg9zWYcey/iu+p1/CIosu8VBUU7ii6f3iyB2QdSI/NxwYbeZbA5lMJ5I3CkdGvzow X-Received: by 2002:a17:902:c6:: with SMTP id a64-v6mr8220129pla.408.1521483648639; Mon, 19 Mar 2018 11:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521483648; cv=none; d=google.com; s=arc-20160816; b=pvavIkx5JOVLKvhTOYIv16UFmSU+OnCxMUhprPlMjzkPWmCM0CQi5O4IV25t/VhXQt a7nTWLUBLbfX0Pjq9Moaxz/1D2HnKwxcApnBvk986ufZXf1gk285mBeOp/BFndFR7rRQ aTMdxFtT0ObG2yUBVfgsQP3jq65Wv2sqUfS1io1z1S9LF3mJh/Ke3cbfIB843tqce7V9 1aYF9y3mCQa3/BiHED39MowbvNFOAv5np8c4yrwOVnm3k7AP/LkG/ZnctbDf0DP3j1dA O+5IDumERohEF6U+SlVA7f74jK8ZrNeVWLduxlMdPTEmS/Uaa20KTtQF0SReeZu1Yc2Q XrUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=HJWMOusX0nmLN8EFzBy0D8mdeY2GpKoLzwPTS9HZ5q4=; b=Wx4TUdrmkMKRHgAe55KwFRUlSrV7G5yPR7GSCAf8N4O937Zt3mb8x0UOkuA+p/SVAN PB1JHBm1wIr/A1BeoEoNPqRv5jgf9Q3s0Tf644jfqnmG6mvHdx7iZpxDBw9AZZNVSIoq Tshyb/Pqw6aC63RSnZQS4OzkHtOTtTotx8A7AmTqTzAZnjVhJmeP2INWiGGqCx3lSaGu wlAqBbg/MjASLpLllVS9MEzdjJudyFWysCD8gsJSYXmbAVy+d7aNqoLu1t1pouRdWJ8J mwotXwKDne18ths8X7GZKTYXmYwoGqbTQY29SiWXu9ZgEzSx2bpzT640ACxNZL7amirj 0ATA== 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 f125si277151pgc.736.2018.03.19.11.20.34; Mon, 19 Mar 2018 11:20:48 -0700 (PDT) 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 S969131AbeCSSTA (ORCPT + 99 others); Mon, 19 Mar 2018 14:19:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46724 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030905AbeCSSSz (ORCPT ); Mon, 19 Mar 2018 14:18:55 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 54EAB106F; Mon, 19 Mar 2018 18:18:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Varsha Rao , Samuel Thibault , Sasha Levin Subject: [PATCH 4.9 004/241] staging: speakup: Replace BUG_ON() with WARN_ON(). Date: Mon, 19 Mar 2018 19:04:29 +0100 Message-Id: <20180319180751.358748837@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Varsha Rao [ Upstream commit d351c2db5420bb17dcd2d9aac7ddb5f64c6d04b3 ] BUG_ON() is replaced with WARN_ON() and EINVAL is returned, when WARN_ON() is true. This fixes the following checkpatch issue: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON(). Signed-off-by: Varsha Rao Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/kobjects.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c @@ -834,7 +834,9 @@ static ssize_t message_show(struct kobje struct msg_group_t *group = spk_find_msg_group(attr->attr.name); unsigned long flags; - BUG_ON(!group); + if (WARN_ON(!group)) + return -EINVAL; + spin_lock_irqsave(&speakup_info.spinlock, flags); retval = message_show_helper(buf, group->start, group->end); spin_unlock_irqrestore(&speakup_info.spinlock, flags); @@ -846,7 +848,9 @@ static ssize_t message_store(struct kobj { struct msg_group_t *group = spk_find_msg_group(attr->attr.name); - BUG_ON(!group); + if (WARN_ON(!group)) + return -EINVAL; + return message_store_helper(buf, count, group); }