Received: by 10.213.65.68 with SMTP id h4csp1798254imn; Mon, 19 Mar 2018 13:33:46 -0700 (PDT) X-Google-Smtp-Source: AG47ELs+QIWf19LVvgDJxPfdDrlwEGNz4Qz7l2XvTdobtDRJyvWjDHqiAA53cad2uTBQVUQgaSZz X-Received: by 2002:a17:902:3f83:: with SMTP id a3-v6mr5595464pld.279.1521491626504; Mon, 19 Mar 2018 13:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521491626; cv=none; d=google.com; s=arc-20160816; b=yOu/DE0NNZOYdz6dZwYPWR7bK620dqnH2LzFIi4Xgolk8l+EKIEt8ZPSCL3bMYuLDe 3qmFN9PhlirvI0E0JlaEMxFTxUo9mGnOHvRdqpqGm68/6EdPXGjX1YHNE1bM/BXjLVfK 2M70jg21pXGse9Rl5Xn0Xws+qHuZJyNwOiDBjRpp6Hquj1NKG9dCk+nyLaVa5yBLVuz5 OSmGoBTj9CNB0uOKV6i04pM0bvQxRSFcfkwmcxEpGKK/KT+tIEyG9fc1epG6ofNIAgPF knKWn4q2bFVFj7gRlsWOrD5XCBvaCOGIIcBNd1f7Tyc6j1N9rCWkhbqzRejDoHClr6Yi Tz+g== 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=v8NdPbMtbpd+FeyoSzH7cMlz4JT90kEZ0nvutMD3vSU=; b=KiA4ylYuRRO84+DtYYWA47gkJ7M7uKXocB7lXWR84Sssus2d4+UffoMGxn/onEIM7W ODZ4d72TS+wLzU7H3Md0qtwcyBW7WNZZJVXaA4caIunfYUwgKDo1CdVCwktkr9wfl7Q1 6Xrzd5dX5hpwfXr7LMDfoyQWFEGsLgKmbvm0F1d/o3iZnEJ2ZYEJ//rqPEaUyZLf7nR8 0/Cq4bFmSMxZjT1MSyCsU+/RvpP4LPlUiU3JteHvMxQNK7IRCqrJ8DCfL5yIhdNvKaIJ I4lOK+8B0xOjxk0XGZ/ffrCvh+bX5CsycYsTC5DCUjRauD32pbsMhod6Ed6fd2qjJWRu N5RA== 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 e5si25295pgf.646.2018.03.19.13.33.02; Mon, 19 Mar 2018 13:33:46 -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 S971330AbeCSU3j (ORCPT + 99 others); Mon, 19 Mar 2018 16:29:39 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43004 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030502AbeCSSNF (ORCPT ); Mon, 19 Mar 2018 14:13:05 -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 E743F11D6; Mon, 19 Mar 2018 18:13:04 +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.4 003/134] staging: speakup: Replace BUG_ON() with WARN_ON(). Date: Mon, 19 Mar 2018 19:04:46 +0100 Message-Id: <20180319171849.537393187@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@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.4-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 @@ -831,7 +831,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); @@ -843,7 +845,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); }