From patchwork Sat Jun 9 18:22:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 927190 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="v0Wb0xTP"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41372B6DmFz9s31 for ; Sun, 10 Jun 2018 04:23:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 77B61C21E08; Sat, 9 Jun 2018 18:23:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id BF1B7C21C6A; Sat, 9 Jun 2018 18:22:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5B01DC21BE5; Sat, 9 Jun 2018 18:22:43 +0000 (UTC) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com [209.85.223.176]) by lists.denx.de (Postfix) with ESMTPS id 14262C21C27 for ; Sat, 9 Jun 2018 18:22:42 +0000 (UTC) Received: by mail-io0-f176.google.com with SMTP id g7-v6so19448766ioh.11 for ; Sat, 09 Jun 2018 11:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=dfTohNwsy6CW8h+sdzq+kK+6V1VT61ci1XyMXBJeijE=; b=v0Wb0xTP3J8ETDQVK9cCuiTEpA1gkfl84rLeWMUUVW9KIVmIdOYmnRGLtdyH8NXHSd 7CbxPME9rIurY7j2uEe0WmGNnSZaD9biw4ZO09Dhx+d3R8VEj2zcldRWnbDTfBphU1N7 R80uzeeBfR3EOBs/E5sFaLBmG0SSEBR9mbGij4PhsWLypaERJ0WUICA0DYszTo5KIhFh qNzUhOIQpCrE6I77refk9ecQa5E2sC0bvob6rZRB/jKBiit5guyaKQ9OTqxyXQULThIm 889el+v5C8oOIbZpmwg7XGev0c3MTJI+quB0ZT55Tv/J4uY7oWJO60ygy9r6aNA2AJ2G Q+8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=dfTohNwsy6CW8h+sdzq+kK+6V1VT61ci1XyMXBJeijE=; b=hcTnsHGFLGJyxaAUHN4GtAlNVabNnUrcbDEVw2fk2fhcXe3VA8bmStDFJYjw1+9Txs 541gYglIJxjyMrZ/HPv8H0CPyurQvAK4J1wY3h4oGzvAAYpNsd0aiO2AV3qEIlr+WMKT kzgNSWfPHNvOpnvzKdqXHG+3SKCTJq2lT2pM9p5uDUE/KyYPG7/aiuTIEDhIPPLTUiki BI/OiR9C+6H4+UD3mQAKKmGu31MRBYAJyLTfWQKBHZf2R0UQxLoenu0afkxpcJBo7xru G/PNmVgR1/wa6cjnwVg6UbmhhmkVlTHMKHRnfkprNHC4Y1oEZBxqZSKSV30fNFxpH7ar 89Vw== X-Gm-Message-State: APt69E1s2teHrG5tcxCcrPNqP4CGjnQpZSGQIsd+IWCIBnt+WPdTHj2T oteh2DOJs6rrjJwr/oS/ecs7nBHPWtw= X-Google-Smtp-Source: ADUXVKI6NIIYOuG68LdtkUZ/afgwwOn3PwIbgwLWjntQ+QUfZD+gmp2OTu+zAuXExJ6/FRVgHBTDWw== X-Received: by 2002:a6b:1884:: with SMTP id 126-v6mr8771281ioy.183.1528568560549; Sat, 09 Jun 2018 11:22:40 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id t130-v6sm2319610ita.19.2018.06.09.11.22.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 11:22:39 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 8BAED14005C; Sat, 9 Jun 2018 12:22:38 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 9 Jun 2018 12:22:27 -0600 Message-Id: <20180609182235.33532-2-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a-goog In-Reply-To: <20180609182235.33532-1-sjg@chromium.org> References: <20180609182235.33532-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH 1/8] log: Fix incorect range check in log_get_cat_name() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This allows access to an element after the end of the array. Fix it. Reported-by: Coverity (CID: 173279) Signed-off-by: Simon Glass --- common/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/log.c b/common/log.c index 3b5588ebe7..4e488eca5b 100644 --- a/common/log.c +++ b/common/log.c @@ -38,7 +38,7 @@ static const char *log_level_name[LOGL_COUNT] = { const char *log_get_cat_name(enum log_category_t cat) { - if (cat > LOGC_COUNT) + if (cat >= LOGC_COUNT) return "invalid"; if (cat >= LOGC_NONE) return log_cat_name[cat - LOGC_NONE];