Received: by 10.223.185.116 with SMTP id b49csp6397699wrg; Wed, 28 Feb 2018 08:44:52 -0800 (PST) X-Google-Smtp-Source: AH8x227MNfFfe1lWKXlG2FNzyZWROwd6/SZmxy1Ap1+JG8aJ8obsDzJIzkLNcF1jA4m6C4+AFFBf X-Received: by 2002:a17:902:720b:: with SMTP id ba11-v6mr17574017plb.148.1519836292377; Wed, 28 Feb 2018 08:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519836292; cv=none; d=google.com; s=arc-20160816; b=1LLRG41kHXS8Lo80D8Yk7AAQNsWC5bPGQCWiv8a6ik9ND5R9bd1qMwYVFXUxfeo7yG q+Fv6O5ZfmVvxB3mgUpbmxaN/Hhqhf6jvP+VA/xRnXa5m1673baJ0QvvBkzY+TXYHWgd WBx1X2R7/fM6a4OzuQqm5jibFn3PG9uIjnOLXc6TbVCsUMScqwp04TduRD6ZUkY7ofpM D0FkBeoXJ8IkclIO1P6pZPta9GrnFvvSthpLb05yz4C6T3JWBq7SL2qqzvs9YUwyvlx8 h3g2yR7P17y1O/6f9i5SvimT8UjrhIGFTvBeRY9nfQ8NcD0Q6v+x4Zxez58hkTV6lG6t Lxzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=F7R79SgRjngHPOVuhhsnXz1tSPwVTUJn24WzXRPnkHg=; b=JpKv/wjPuuZMjnJ0YHUhiyjRvokmNCSFT3QA7BCPfjB1B99Bw4pdhLBdXemwwdjSfx 2ZqdlZe/9qZZn0jhYs90TSYmJEQ8iancRV+tgAR10VLeQwS6lOC6UKXPQCoXKsLXr/us shoMfGDdHB5nlpdSKg9FyK86Os8Y8kcXbXlNfUdKVRdWJvXzIquPd357q3nhxMXR6C2s b2+m6so8LFmGnrUz+fnCdLffEij7U0A/dRChudoukbCqAOge+sZEmHqxNo7L3glaZ+0H 214k5sAEI5MF+yt6b2uKsrb7JTy6U50gS3e8WjUzhLHtAav8NK3vqfL6559LlI2roUVT KYFw== 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 g11si1231067pgf.5.2018.02.28.08.44.37; Wed, 28 Feb 2018 08:44:52 -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 S932186AbeB1QCs (ORCPT + 99 others); Wed, 28 Feb 2018 11:02:48 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34727 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753147AbeB1QCo (ORCPT ); Wed, 28 Feb 2018 11:02:44 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yg-0006XT-PM; Wed, 28 Feb 2018 15:22:19 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Ye-0008SB-TI; Wed, 28 Feb 2018 15:22:16 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Dan Carpenter" , "Jason Wessel" , "Daniel Thompson" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 062/254] kdb: Fix handling of kallsyms_symbol_next() return value In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Thompson commit c07d35338081d107e57cf37572d8cc931a8e32e2 upstream. kallsyms_symbol_next() returns a boolean (true on success). Currently kdb_read() tests the return value with an inequality that unconditionally evaluates to true. This is fixed in the obvious way and, since the conditional branch is supposed to be unreachable, we also add a WARN_ON(). Reported-by: Dan Carpenter Signed-off-by: Daniel Thompson Signed-off-by: Jason Wessel Signed-off-by: Ben Hutchings --- kernel/debug/kdb/kdb_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -349,7 +349,7 @@ poll_again: } kdb_printf("\n"); for (i = 0; i < count; i++) { - if (kallsyms_symbol_next(p_tmp, i) < 0) + if (WARN_ON(!kallsyms_symbol_next(p_tmp, i))) break; kdb_printf("%s ", p_tmp); *(p_tmp + len) = '\0';