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.6 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,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 84393C433EF for ; Mon, 6 Sep 2021 14:05:54 +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 C211A60F12 for ; Mon, 6 Sep 2021 14:05:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C211A60F12 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaa.org.ua 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 A7CFA83200; Mon, 6 Sep 2021 16:05:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kaa.org.ua Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 7A1CD83200; Mon, 6 Sep 2021 16:05:49 +0200 (CEST) Received: from smtp.220.in.ua (smtp.220.in.ua [89.184.67.205]) by phobos.denx.de (Postfix) with ESMTP id 62A86831BF for ; Mon, 6 Sep 2021 16:05:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kaa.org.ua Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=oleg@kaa.org.ua Received: from [172.16.31.81] (unknown [149.255.131.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.220.in.ua (Postfix) with ESMTPSA id 618A51A2046A; Mon, 6 Sep 2021 17:05:44 +0300 (EEST) From: Oleh Kravchenko Subject: Re: [scan-admin@coverity.com: New Defects reported by Coverity Scan for Das U-Boot] To: Tom Rini , u-boot@lists.denx.de References: <20210830173900.GE858@bill-the-cat> Message-ID: <3a339966-4823-0b4b-1e7b-b65d0c1049cf@kaa.org.ua> Date: Mon, 6 Sep 2021 17:05:40 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210830173900.GE858@bill-the-cat> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: uk-UA 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 Hello Tom! Looks like it a false positive detection. info and dev_desc are validated in few lines above: 609 |    if (!info.name[0] && 610 |        fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0) 611 |        return; 30.08.21 20:39, Tom Rini пише: > Hey all, > > Here's the latest report. > > ----- Forwarded message from scan-admin@coverity.com ----- > > Date: Mon, 30 Aug 2021 16:58:54 +0000 (UTC) > From: 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 found with Coverity Scan. > > 2 new defect(s) introduced to Das U-Boot found with Coverity Scan. > > > New defect(s) Reported-by: Coverity Scan > Showing 2 of 2 defect(s) > > > ** CID 338648: Memory - illegal accesses (UNINIT) > /drivers/fastboot/fb_mmc.c: 618 in fastboot_mmc_flash_write() > > > ________________________________________________________________________________________________________ > *** CID 338648: Memory - illegal accesses (UNINIT) > /drivers/fastboot/fb_mmc.c: 618 in fastboot_mmc_flash_write() > 612 > 613 if (is_sparse_image(download_buffer)) { > 614 struct fb_mmc_sparse sparse_priv; > 615 struct sparse_storage sparse; > 616 int err; > 617 >>>> CID 338648: Memory - illegal accesses (UNINIT) >>>> Using uninitialized value "dev_desc". > 618 sparse_priv.dev_desc = dev_desc; > 619 > 620 sparse.blksz = info.blksz; > 621 sparse.start = info.start; > 622 sparse.size = info.size; > 623 sparse.write = fb_mmc_sparse_write; > > ** CID 338647: Integer handling issues (DIVIDE_BY_ZERO) > > > ________________________________________________________________________________________________________ > *** CID 338647: Integer handling issues (DIVIDE_BY_ZERO) > /drivers/fastboot/fb_mmc.c: 631 in fastboot_mmc_flash_write() > 625 sparse.mssg = fastboot_fail; > 626 > 627 printf("Flashing sparse image at offset " LBAFU "\n", > 628 sparse.start); > 629 > 630 sparse.priv = &sparse_priv; >>>> CID 338647: Integer handling issues (DIVIDE_BY_ZERO) >>>> In function call "write_sparse_image", division by expression "sparse.blksz" which may be zero has undefined behavior. > 631 err = write_sparse_image(&sparse, cmd, download_buffer, > 632 response); > 633 if (!err) > 634 fastboot_okay(NULL, response); > 635 } else { > 636 write_raw_image(dev_desc, &info, cmd, download_buffer, > > > ________________________________________________________________________________________________________ > To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yoA22WlOQ-2By3ieUvdbKmOyw68TMVT4Kip-2BBzfOGWXJ5yIiYplmPF9KAnKIja4Zd7tU-3DB0R5_EEm8SbLgSDsaDZif-2Bv7ch8WqhKpLoKErHi4nXpwDNTsWpxO-2FB72i0SdTN3-2BHFJyiYovM6CPwd6hE024NqoJv2G1PZTeHMVC9jxFLJgI9alL1SVy-2FumNUJ7wQLM0LhmayO628LnXGSp6-2BQxL8eWMnX8DfYwdG1iiYjTCUb6p6N4KZqayMpDRL0dNo-2FZrxTT-2FAz2SR1H1kktB9lp0iaajH-2BQ-3D-3D > > To manage Coverity Scan email notifications for "tom.rini@gmail.com", click https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yped04pjJnmXOsUBtKYNIXxWeIHzDeopm-2BEWQ6S6K-2FtUHv9ZTk8qZbuzkkz9sa-2BJFw4elYDyedRVZOC-2ButxjBZdouVmTGuWB6Aj6G7lm7t25-2Biv1B-2B9082pHzCCex2kqMs-3DiOdo_EEm8SbLgSDsaDZif-2Bv7ch8WqhKpLoKErHi4nXpwDNTsWpxO-2FB72i0SdTN3-2BHFJyiTVHAVBb1e5w6-2BMjbd4JHjfrBraKGFtJ28aslex2Dq-2BGKoKqFa9LXDqSXKh1T4x2FIG8bOrMBw8qOG48BL8SGCU5Fh4Mz3heVvRktq2Dv-2Bu-2Fb8WoqCxYHUiUWEtrXPETG439ARsKn2eC80b78pwPIaQ-3D-3D > > > ----- End forwarded message ----- >