From patchwork Thu Sep 17 07:42:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7202911 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 64E9A9F40A for ; Thu, 17 Sep 2015 07:43:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 929E6207C2 for ; Thu, 17 Sep 2015 07:43:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 925CE207C1 for ; Thu, 17 Sep 2015 07:43:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753782AbbIQHnQ (ORCPT ); Thu, 17 Sep 2015 03:43:16 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:33629 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753668AbbIQHnP (ORCPT ); Thu, 17 Sep 2015 03:43:15 -0400 Received: by pacex6 with SMTP id ex6so13429305pac.0; Thu, 17 Sep 2015 00:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=wf6LeWdW3d/d78h9669EDPTgQu9C5unXh1q6vt4YC8s=; b=x69w7m5GZX+QvTIfEBr0TLF/ynFWDnotJBlhSkL7exJaGrYHCBYojojuXFGiQsww63 Y4/P4EuxtzJDV5jHGgxW8Npz+yftsN+QjOYDhTM2943SpNLejDv3c/s4hLetlwFRIFTi 5UZwdGhvzr468jR/DjXYM1u2q9mVaIE+a4SNPeOAzUJnYKFtCR3yeIi5y2ku1t82z82E FUfFx0EiKKcbhGbpyaYBgzGnmSraSGiJFmdz2BwyMrunmPZcFue+L3i3TMBSBRAhegig mq1mdtb2pbxc1s/Wz1k2hp7D/nZROBOdXpHuRw6/berw9lnIWLFvF0Gf0XrMGyN+d4Di SHLg== X-Received: by 10.66.148.71 with SMTP id tq7mr69290826pab.0.1442475795250; Thu, 17 Sep 2015 00:43:15 -0700 (PDT) Received: from localhost.localdomain ([49.206.249.64]) by smtp.gmail.com with ESMTPSA id rz9sm2010092pbb.61.2015.09.17.00.43.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Sep 2015 00:43:14 -0700 (PDT) From: Sudip Mukherjee To: Herbert Xu , "David S. Miller" Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Sudip Mukherjee Subject: [PATCH] X.509: remove always false comparison Date: Thu, 17 Sep 2015 13:12:51 +0530 Message-Id: <1442475771-15570-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP hour, min and sec are unsigned int and they can never be less than zero. Signed-off-by: Sudip Mukherjee --- crypto/asymmetric_keys/x509_cert_parser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c index af71878..3000ea3 100644 --- a/crypto/asymmetric_keys/x509_cert_parser.c +++ b/crypto/asymmetric_keys/x509_cert_parser.c @@ -546,9 +546,9 @@ int x509_decode_time(time64_t *_t, size_t hdrlen, if (year < 1970 || mon < 1 || mon > 12 || day < 1 || day > mon_len || - hour < 0 || hour > 23 || - min < 0 || min > 59 || - sec < 0 || sec > 59) + hour > 23 || + min > 59 || + sec > 59) goto invalid_time; *_t = mktime64(year, mon, day, hour, min, sec);