From patchwork Mon Mar 2 14:13:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 45288 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C3B452149C for ; Mon, 2 Mar 2015 14:13:42 +0000 (UTC) Received: by lbiv13 with SMTP id v13sf7051760lbi.1 for ; Mon, 02 Mar 2015 06:13:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Jv/8w0Lvx9kGqlnWMebxQZU129GqJas7XQlKpdpe+gc=; b=FbgZ023FFoPgdWRg4HOmXxgLE6ajxRBqOdncVa4v6L2x+/xR6B9UaJH1dIQSK+KVi0 UPD/cFZmGYxBGkWZHXR45jBG9zvBO4YRDmSha5ciTYn36kcSNOL15gbk/+kSCxcShcX5 MaGvfxoHI+PcfzFOqNgWC/FA//D66pNlzhB6GpnWLaIumqLvNIbKF36bqCNLnC96uFus NG77N6xUX4uaDcZ3bqhxtAc0Wd1OSObQPwk8COP4N8dIrPnlXb4C1w15Ww6ZYZZcE3Ms pBJD724X1x8Q3Xf79J35UzwA6Evq4OaNrM+J0/AOHAgKe3WsgE0Y127hQvIOu3dMyGdx WGHg== X-Gm-Message-State: ALoCoQmt7UZFgFXmoJIUKalKtzVpMEhmD5wBtblO9fNnE5BHuQK1yO3lljOEamBlettlSNnMf82P X-Received: by 10.180.72.44 with SMTP id a12mr2234139wiv.0.1425305621763; Mon, 02 Mar 2015 06:13:41 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.180 with SMTP id jp20ls405135lab.64.gmail; Mon, 02 Mar 2015 06:13:41 -0800 (PST) X-Received: by 10.112.12.98 with SMTP id x2mr24275147lbb.3.1425305621574; Mon, 02 Mar 2015 06:13:41 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id xw3si2026091lbb.128.2015.03.02.06.13.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 06:13:41 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by labgq15 with SMTP id gq15so30553531lab.6 for ; Mon, 02 Mar 2015 06:13:41 -0800 (PST) X-Received: by 10.152.197.34 with SMTP id ir2mr24344640lac.36.1425305621306; Mon, 02 Mar 2015 06:13:41 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.35.133 with SMTP id h5csp5551147lbj; Mon, 2 Mar 2015 06:13:40 -0800 (PST) X-Received: by 10.180.198.162 with SMTP id jd2mr35339013wic.21.1425305620628; Mon, 02 Mar 2015 06:13:40 -0800 (PST) Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com. [209.85.212.174]) by mx.google.com with ESMTPS id e19si18762491wiw.44.2015.03.02.06.13.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 06:13:40 -0800 (PST) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.212.174 as permitted sender) client-ip=209.85.212.174; Received: by wiwl15 with SMTP id l15so15127127wiw.3 for ; Mon, 02 Mar 2015 06:13:40 -0800 (PST) X-Received: by 10.180.7.131 with SMTP id j3mr37046050wia.55.1425305620102; Mon, 02 Mar 2015 06:13:40 -0800 (PST) Received: from wychelm.lan (cpc4-aztw19-0-0-cust71.18-1.cable.virginm.net. [82.33.25.72]) by mx.google.com with ESMTPSA id q6sm16245139wix.13.2015.03.02.06.13.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 06:13:39 -0800 (PST) From: Daniel Thompson To: Jason Wessel Cc: Daniel Thompson , linux-kernel@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net, Andrew Morton , Ingo Molnar , patches@linaro.org, linaro-kernel@lists.linaro.org, John Stultz , Sumit Semwal Subject: [PATCH] kdb: Fix handling of kallsyms_symbol_next() return value Date: Mon, 2 Mar 2015 14:13:36 +0000 Message-Id: <1425305616-19656-1-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.1.0 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- kernel/debug/kdb/kdb_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.1.0 diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index fc1ef73..77777d9 100644 --- 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';