Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8BF94C001DC for ; Mon, 31 Jul 2023 14:08:53 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E3A2986A75; Mon, 31 Jul 2023 16:08:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="iTQx08pO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7697586A83; Mon, 31 Jul 2023 16:08:50 +0200 (CEST) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4C4F486A75 for ; Mon, 31 Jul 2023 16:08:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dan.carpenter@linaro.org Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31781e15a0cso3812496f8f.3 for ; Mon, 31 Jul 2023 07:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690812525; x=1691417325; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=rejx3qexYR/QGpDKGHk3P6HW7UtUmyVEsmauwcZ3/ZA=; b=iTQx08pOQiltaGecgGSOfnWX5fxVtsA3nhPmh6CG9ZRsqj8Ex/W5ELZmNX75m83Nwu nAL1a1DTIahx/H2gi3lWQpx25qVGXQt3ihDjKFiWCl4SAFS8L9lJy2YWo7rfXc48YpCm XwwCRYiLadDnfICkssPCoRbxmrMu8HGg5gnThRdtlGl6gwXeO8op9lrafWfQUrtzbbSV po78/lcmsR6injpo0H/naq6TtDnKT6JkFfKSP1cPa6zK3UGvkI1lNcGHqsf5q9ojAsoq I/9esEIYp0vLNY6gdnk4nBRGknh37qHo6CDvf2AfjSOHSPy8wM0ogjXDl3OJsmW18pQK eAgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690812525; x=1691417325; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rejx3qexYR/QGpDKGHk3P6HW7UtUmyVEsmauwcZ3/ZA=; b=FGOfBRVintCHQrkxPuXaZPUsEuB3K7/uQ/Q4/yc3tIJrGXeArzXu9oe0Px0xlukdO7 QtqJcBkeSCMEWrxD26eKJBTYlRZ9sPGVWejqji8EpzGG27lgjHrIfuRWg+uiirm7pTXQ rZSy+CZf6lxXrsFbAyZIH70edCVLNYQASV1xP2XlbaH+Z+TCUZ7qv+Nd0yHoeFW9nvdG c3cBJROPT5Mov6C8laE2vEA1GNCpn/gBANu89kSWuMGaYspbWQGi9HqYzhiMc5sGmC/+ VqkrTt+9mFmSzwhS3pOxGtaw5EQCo6HogFu1VGAAyOMFg3gHyWdjsUGbtWKamGjkPb+l ydhw== X-Gm-Message-State: ABy/qLZJEiR6ENkoU0877u6XKhJxdEb1afHprRij3nqy3V4h0xlqmPv/ KqUmExqfe2nHWBCPj3P9BlGBtNuNWVSoSYBcXhw= X-Google-Smtp-Source: APBJJlE17r/PgBiGoYEuPGL+gqRDW3fvdYLH/WLoXddXCnJtuzTL1H28AlKPHq43UL0ru/NU8expyQ== X-Received: by 2002:adf:f60e:0:b0:313:ebf3:f817 with SMTP id t14-20020adff60e000000b00313ebf3f817mr7019542wrp.22.1690812524727; Mon, 31 Jul 2023 07:08:44 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id z11-20020adfdf8b000000b003179c119e1bsm5726255wrl.32.2023.07.31.07.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:08:44 -0700 (PDT) Date: Mon, 31 Jul 2023 17:08:41 +0300 From: Dan Carpenter To: AKASHI Takahiro Cc: u-boot@lists.denx.de Subject: [PATCH] test: fix a couple NULL vs IS_ERR() checks Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The x509_cert_parse() and pkcs7_parse_message() functions return error pointers. They don't return NULL. Update the checks accordingly. Signed-off-by: Dan Carpenter --- test/lib/asn1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/lib/asn1.c b/test/lib/asn1.c index 8661fdd30687..a66cdd77df0a 100644 --- a/test/lib/asn1.c +++ b/test/lib/asn1.c @@ -120,7 +120,7 @@ static int lib_asn1_x509(struct unit_test_state *uts) cert = x509_cert_parse(cert_data, cert_data_len); - ut_assertf(cert != NULL, "decoding failed\n"); + ut_assertf(!IS_ERR(cert), "decoding failed\n"); ut_assertf(!strcmp(cert->subject, "Linaro: Tester"), "subject doesn't match\n"); ut_assertf(!strcmp(cert->issuer, "Linaro: Tester"), @@ -313,7 +313,7 @@ static int lib_asn1_pkcs7(struct unit_test_state *uts) pkcs7 = pkcs7_parse_message(image_pk7, image_pk7_len); - ut_assertf(pkcs7 != NULL, "decoding failed\n"); + ut_assertf(!IS_ERR(pkcs7), "decoding failed\n"); ut_assertf(pkcs7->data_len == 104, "signature size doesn't match\n"); ut_assertf(pkcs7->signed_infos != NULL, "sign-info doesn't exist\n"); ut_assertf(pkcs7->signed_infos->msgdigest_len == 32, -- 2.39.2