From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6CB5C4338F for ; Tue, 27 Jul 2021 02:52:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2BF3860F37 for ; Tue, 27 Jul 2021 02:52:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2BF3860F37 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 15D70832DC; Tue, 27 Jul 2021 04:52:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="ZjBfffP/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6FAE283333; Tue, 27 Jul 2021 04:52:19 +0200 (CEST) Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) (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 EBD0582AE5 for ; Tue, 27 Jul 2021 04:52:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x82e.google.com with SMTP id h10so8582140qth.5 for ; Mon, 26 Jul 2021 19:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=rNh00IQpzkOp4f9UEVzlU/kUCVucWYwb8G+ZKDgerd4=; b=ZjBfffP/AsLmWPLoP2VsXBkJ7Y7nli0MeKBwfmbY+R5VLSiFDmaKPkTb2SQlNjLDS6 7UVvhnkPn7YJEU0ZKoYSsAtkYzBcIGYGLVWINVZ4BFVEU03pxgPf5v7WmYt+JQpYd6f2 I7ePCYfx5lu4jcpQARquVsebRCsnT9BL9Vh70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=rNh00IQpzkOp4f9UEVzlU/kUCVucWYwb8G+ZKDgerd4=; b=XN+O0sK9aHxr1BzVSJSqmv2OfKhI3ukeSSCrbGi7NF+GjiwJPWJm3VHC1nF4rAG7S4 /pP6zOY2MSONNz/Z3h365gATs5i4xocj196bOyetgJXOBLfKC2Qe+toyobM79niIyVDn cv00/f/78aU7YHp2KtPSutVHjr+/RD3ore76cTn9YEZ4H7G1ANYomD5wQ1m00ifVdUNo 677hFG1P6K44xDA74jVDQJNy0tDuaAxb2lpXs0rJAxu+ryEFlRgXaz7908LLA3Y/QNnf W3amfaFfwF3av03SmqJH5teEQTfldYrRI84eGUdkmkb1fMrmxW9cATgAiXAcwgNV0nFD MWhw== X-Gm-Message-State: AOAM531CzXVt3zToVb5YvyS61I/FJE6iurzNr3Azd4zwwErJa491xTm9 xctBlEDIesotzStTgVMKZEvKx3h8EcWdLA== X-Google-Smtp-Source: ABdhPJzgSTxWPBIpJ5ucqERrG5nt2u9r3Mhrc0d90H7J37nfuZlzcVvR2owuv2xEjgxwfmQvC38x9Q== X-Received: by 2002:ac8:7dcb:: with SMTP id c11mr7051013qte.260.1627354333458; Mon, 26 Jul 2021 19:52:13 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-f53f-8332-072c-4f35.res6.spectrum.com. [2603:6081:7b01:cbda:f53f:8332:72c:4f35]) by smtp.gmail.com with ESMTPSA id r16sm1023284qke.73.2021.07.26.19.52.12 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Jul 2021 19:52:12 -0700 (PDT) Date: Mon, 26 Jul 2021 22:52:10 -0400 From: Tom Rini To: u-boot@lists.denx.de, Simon Glass , Sean Anderson Subject: [scan-admin@coverity.com: New Defects reported by Coverity Scan for Das U-Boot] Message-ID: <20210727025210.GE9379@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="c5jIKqLJqsIKqNdf" Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean --c5jIKqLJqsIKqNdf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable ----- Forwarded message from scan-admin@coverity.com ----- Date: Tue, 27 Jul 2021 01:10:27 +0000 (UTC) =46rom: scan-admin@coverity.com To: tom.rini@gmail.com Subject: New Defects reported by Coverity Scan for Das U-Boot Hi, Please find the latest report on new defect(s) introduced to Das U-Boot fou= nd with Coverity Scan. 6 new defect(s) introduced to Das U-Boot found with Coverity Scan. 9 defect(s), reported by Coverity Scan earlier, were marked fixed in the re= cent build analyzed by Coverity Scan. New defect(s) Reported-by: Coverity Scan Showing 6 of 6 defect(s) ** CID 332931: Control flow issues (NO_EFFECT) /drivers/clk/clk_kendryte.c: 852 in k210_pll_set_rate() ___________________________________________________________________________= _____________________________ *** CID 332931: Control flow issues (NO_EFFECT) /drivers/clk/clk_kendryte.c: 852 in k210_pll_set_rate() 846 int err; 847 const struct k210_pll_params *pll =3D &k210_plls[id]; 848 struct k210_pll_config config =3D {}; 849 u32 reg; 850 ulong calc_rate; 851 =20 >>> CID 332931: Control flow issues (NO_EFFECT) >>> This less-than-zero comparison of an unsigned value is never true. = "rate_in < 0UL". 852 if (rate_in < 0) 853 return rate_in; 854 =20 855 err =3D k210_pll_calc_config(rate, rate_in, &config); 856 if (err) 857 return err; ** CID 332930: Integer handling issues (NO_EFFECT) /lib/display_options.c: 216 in print_buffer() ___________________________________________________________________________= _____________________________ *** CID 332930: Integer handling issues (NO_EFFECT) /lib/display_options.c: 216 in print_buffer() 210 while (count) { 211 uint thislinelen; 212 char buf[HEXDUMP_MAX_BUF_LENGTH(width * linelen)]; 213 =20 214 thislinelen =3D hexdump_line(addr, data, width, count, linelen, 215 buf, sizeof(buf)); >>> CID 332930: Integer handling issues (NO_EFFECT) >>> This greater-than-or-equal-to-zero comparison of an unsigned value = is always true. "thislinelen >=3D 0U". 216 assert(thislinelen >=3D 0); 217 puts(buf); 218 putc('\n'); 219 =20 220 /* update references */ 221 data +=3D thislinelen * width; ** CID 332929: Integer handling issues (NO_EFFECT) /drivers/clk/clk_kendryte.c: 898 in k210_pll_get_rate() ___________________________________________________________________________= _____________________________ *** CID 332929: Integer handling issues (NO_EFFECT) /drivers/clk/clk_kendryte.c: 898 in k210_pll_get_rate() 892 static ulong k210_pll_get_rate(struct k210_clk_priv *priv, int id, 893 ulong rate_in) 894 { 895 u64 r, f, od; 896 u32 reg =3D readl(priv->base + k210_plls[id].off); 897 =20 >>> CID 332929: Integer handling issues (NO_EFFECT) >>> This less-than-zero comparison of an unsigned value is never true. = "rate_in < 0UL". 898 if (rate_in < 0 || (reg & K210_PLL_BYPASS)) 899 return rate_in; 900 =20 901 if (!(reg & K210_PLL_PWRD)) 902 return 0; 903 =20 ** CID 332928: Integer handling issues (NO_EFFECT) /common/log.c: 305 in _log_buffer() ___________________________________________________________________________= _____________________________ *** CID 332928: Integer handling issues (NO_EFFECT) /common/log.c: 305 in _log_buffer() 299 while (count) { 300 uint thislinelen; 301 char buf[HEXDUMP_MAX_BUF_LENGTH(width * linelen)]; 302 =20 303 thislinelen =3D hexdump_line(addr, data, width, count, linelen, 304 buf, sizeof(buf)); >>> CID 332928: Integer handling issues (NO_EFFECT) >>> This greater-than-or-equal-to-zero comparison of an unsigned value = is always true. "thislinelen >=3D 0U". 305 assert(thislinelen >=3D 0); 306 _log(cat, level, file, line, func, "%s\n", buf); 307 =20 308 /* update references */ 309 data +=3D thislinelen * width; 310 addr +=3D thislinelen * width; ** CID 332927: (DIVIDE_BY_ZERO) /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() ___________________________________________________________________________= _____________________________ *** CID 332927: (DIVIDE_BY_ZERO) /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() 778 } else { 779 /* 780 * There is no way to only divide once; we need 781 * to examine the frequency with and without the 782 * effect of od. 783 */ >>> CID 332927: (DIVIDE_BY_ZERO) >>> In function call "__div64_32", division by expression "__base" whic= h may be zero has undefined behavior. 784 u64 vco =3D DIV_ROUND_CLOSEST_ULL(rate_in * f, r); 785 =20 786 if (vco > 1750000000 || vco < 340000000) 787 out_of_spec =3D true; 788 } 789 =20 /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() 778 } else { 779 /* 780 * There is no way to only divide once; we need 781 * to examine the frequency with and without the 782 * effect of od. 783 */ >>> CID 332927: (DIVIDE_BY_ZERO) >>> In expression "(u32)_tmp % __base", modulo by expression "__base" w= hich may be zero has undefined behavior. 784 u64 vco =3D DIV_ROUND_CLOSEST_ULL(rate_in * f, r); 785 =20 786 if (vco > 1750000000 || vco < 340000000) 787 out_of_spec =3D true; 788 } 789 =20 /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() 778 } else { 779 /* 780 * There is no way to only divide once; we need 781 * to examine the frequency with and without the 782 * effect of od. 783 */ >>> CID 332927: (DIVIDE_BY_ZERO) >>> In function call "__div64_32", division by expression "__base" whic= h may be zero has undefined behavior. 784 u64 vco =3D DIV_ROUND_CLOSEST_ULL(rate_in * f, r); 785 =20 786 if (vco > 1750000000 || vco < 340000000) 787 out_of_spec =3D true; 788 } 789 =20 /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() 778 } else { 779 /* 780 * There is no way to only divide once; we need 781 * to examine the frequency with and without the 782 * effect of od. 783 */ >>> CID 332927: (DIVIDE_BY_ZERO) >>> In function call "__div64_32", division by expression "__base" whic= h may be zero has undefined behavior. 784 u64 vco =3D DIV_ROUND_CLOSEST_ULL(rate_in * f, r); 785 =20 786 if (vco > 1750000000 || vco < 340000000) 787 out_of_spec =3D true; 788 } 789 =20 /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() 778 } else { 779 /* 780 * There is no way to only divide once; we need 781 * to examine the frequency with and without the 782 * effect of od. 783 */ >>> CID 332927: (DIVIDE_BY_ZERO) >>> In function call "__div64_32", division by expression "__base" whic= h may be zero has undefined behavior. 784 u64 vco =3D DIV_ROUND_CLOSEST_ULL(rate_in * f, r); 785 =20 786 if (vco > 1750000000 || vco < 340000000) 787 out_of_spec =3D true; 788 } 789 =20 /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() 778 } else { 779 /* 780 * There is no way to only divide once; we need 781 * to examine the frequency with and without the 782 * effect of od. 783 */ >>> CID 332927: (DIVIDE_BY_ZERO) >>> In function call "__div64_32", division by expression "__base" whic= h may be zero has undefined behavior. 784 u64 vco =3D DIV_ROUND_CLOSEST_ULL(rate_in * f, r); 785 =20 786 if (vco > 1750000000 || vco < 340000000) 787 out_of_spec =3D true; 788 } 789 =20 /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() 778 } else { 779 /* 780 * There is no way to only divide once; we need 781 * to examine the frequency with and without the 782 * effect of od. 783 */ >>> CID 332927: (DIVIDE_BY_ZERO) >>> In expression "(u32)_tmp % __base", modulo by expression "__base" w= hich may be zero has undefined behavior. 784 u64 vco =3D DIV_ROUND_CLOSEST_ULL(rate_in * f, r); 785 =20 786 if (vco > 1750000000 || vco < 340000000) 787 out_of_spec =3D true; 788 } 789 =20 /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() 778 } else { 779 /* 780 * There is no way to only divide once; we need 781 * to examine the frequency with and without the 782 * effect of od. 783 */ >>> CID 332927: (DIVIDE_BY_ZERO) >>> In expression "(u32)_tmp % __base", modulo by expression "__base" w= hich may be zero has undefined behavior. 784 u64 vco =3D DIV_ROUND_CLOSEST_ULL(rate_in * f, r); 785 =20 786 if (vco > 1750000000 || vco < 340000000) 787 out_of_spec =3D true; 788 } 789 =20 /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() 778 } else { 779 /* 780 * There is no way to only divide once; we need 781 * to examine the frequency with and without the 782 * effect of od. 783 */ >>> CID 332927: (DIVIDE_BY_ZERO) >>> In expression "(u32)_tmp % __base", modulo by expression "__base" w= hich may be zero has undefined behavior. 784 u64 vco =3D DIV_ROUND_CLOSEST_ULL(rate_in * f, r); 785 =20 786 if (vco > 1750000000 || vco < 340000000) 787 out_of_spec =3D true; 788 } 789 =20 /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() 778 } else { 779 /* 780 * There is no way to only divide once; we need 781 * to examine the frequency with and without the 782 * effect of od. 783 */ >>> CID 332927: (DIVIDE_BY_ZERO) >>> In expression "(u32)_tmp % __base", modulo by expression "__base" w= hich may be zero has undefined behavior. 784 u64 vco =3D DIV_ROUND_CLOSEST_ULL(rate_in * f, r); 785 =20 786 if (vco > 1750000000 || vco < 340000000) 787 out_of_spec =3D true; 788 } 789 =20 /drivers/clk/clk_kendryte.c: 784 in k210_pll_calc_config() 778 } else { 779 /* 780 * There is no way to only divide once; we need 781 * to examine the frequency with and without the 782 * effect of od. 783 */ >>> CID 332927: (DIVIDE_BY_ZERO) >>> In expression "(u32)_tmp % __base", modulo by expression "__base" w= hich may be zero has undefined behavior. 784 u64 vco =3D DIV_ROUND_CLOSEST_ULL(rate_in * f, r); 785 =20 786 if (vco > 1750000000 || vco < 340000000) 787 out_of_spec =3D true; 788 } 789 =20 ** CID 332926: API usage errors (CHAR_IO) /common/autoboot.c: 95 in passwd_abort_crypt() ___________________________________________________________________________= _____________________________ *** CID 332926: API usage errors (CHAR_IO) /common/autoboot.c: 95 in passwd_abort_crypt() 89 do { 90 if (tstc()) { 91 /* Check for input string overflow */ 92 if (presskey_len >=3D sizeof(presskey)) 93 return 0; 94 =20 >>> CID 332926: API usage errors (CHAR_IO) >>> Assigning the return value of "getchar" to char "presskey[presskey_= len]" truncates its value. 95 presskey[presskey_len] =3D getchar(); 96 =20 97 if ((presskey[presskey_len] =3D=3D '\r') || 98 (presskey[presskey_len] =3D=3D '\n')) { 99 if (IS_ENABLED(CONFIG_AUTOBOOT_NEVER_TIMEOUT) && 100 !presskey_len) { ___________________________________________________________________________= _____________________________ To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.n= et/ls/click?upn=3DHRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yoA22WlOQ-2By3= ieUvdbKmOyw68TMVT4Kip-2BBzfOGWXJ5yIiYplmPF9KAnKIja4Zd7tU-3DgJHe_EEm8SbLgSDs= aDZif-2Bv7ch8WqhKpLoKErHi4nXpwDNTvYvjbZ9T6kqAgpHsL-2FhWyLWnQSgvdEHm6q866xWq= hF8Kmj20Sw-2BzKXCiftzibA0uYIZFV1vWC-2FCXF6Dh6IUI5qabfVwsX4r17fuZmWj1IE9lgKH= s0WTSBRQjnbruexWDlIvVYutFNrdA8azZiOmUFO6-2FIEOap-2BpBRs7mGOMMevZw-3D-3D To manage Coverity Scan email notifications for "tom.rini@gmail.com", cli= ck https://u15810271.ct.sendgrid.net/ls/click?upn=3DHRESupC-2F2Czv4BOaCWWCy= 7my0P0qcxCbhZ31OYv50yped04pjJnmXOsUBtKYNIXxWeIHzDeopm-2BEWQ6S6K-2FtUHv9ZTk8= qZbuzkkz9sa-2BJFw4elYDyedRVZOC-2ButxjBZdouVmTGuWB6Aj6G7lm7t25-2Biv1B-2B9082= pHzCCex2kqMs-3DJ_Gj_EEm8SbLgSDsaDZif-2Bv7ch8WqhKpLoKErHi4nXpwDNTvYvjbZ9T6kq= AgpHsL-2FhWyLCbMsoi8Sh2iVNRO-2F4TymJeWpR6YUe5abzfxZiSqdMBZVlERkyaxx1HaUIY6r= 92vdxJPh9Y1P2q2Jzb9e1sOCST8P9RzKNS5Cgy-2F0NiCXVB-2F-2BEazUIg-2BeJSNSm4v-2Bk= e0oWlGf3b6Paw7Los1KuqTOiQ-3D-3D ----- End forwarded message ----- --=20 Tom --c5jIKqLJqsIKqNdf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmD/dNMACgkQFHw5/5Y0 tyz9hwv9HtsgVQaBnjgFnQS0VgV7np0g7r5jDOXGA9PyOM0DIxIDvk5iBruHFMMk buF7pcJUB7CdV9pmPMg4GWnv5k74mcrJdf7llmf5Ho79vR1IivO/CZeySmi9BFGH iSO7jY4eKm+9oF0vyeGTl4lVFgM61KemslYA7zh8JNA4nYvTOqD25D38mFXl71eS RtsyIy1IITyW9PkPx5tc6K9e7f1RdgXQM4DqmdrM9kuzTSbqXDGr05sQEGTAbhsB T/bjYB/Aggp+2ZqyxWoLAgkgiHngszF8UevHEfpqemolBb2nuCbW6qtjIXiCR26V 5yUB9s1hm7svVB+j4/Tbjy1NW5lJBUDqP2Jr1+TtLvSW7VrEwWWGvCCfAWDwe1kB p113qB+vQ1ei/IXjDw0NyaPAcBP2hDu74t14tTxyNl3X92wuXwzgMieLF2CYBDDU dFmGV/E/ifadts88MpTsu/A5Mk+HpYEEeL9ExSomlg8RVwSllJ0z3Z3VLQmHphIQ EI262/ns =AuRT -----END PGP SIGNATURE----- --c5jIKqLJqsIKqNdf--