lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211019183939.bfgpcewtyrutfsky@skbuf>
Date:   Tue, 19 Oct 2021 18:39:40 +0000
From:   Ioana Ciornei <ioana.ciornei@....com>
To:     Tim Gardner <tim.gardner@...onical.com>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Roy Pledge <Roy.Pledge@....com>, Leo Li <leoyang.li@....com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v2][net-next] soc: fsl: dpio: Unsigned compared against 0
 in qbman_swp_set_irq_coalescing()

On Tue, Oct 19, 2021 at 06:19:25AM -0600, Tim Gardner wrote:
> Coverity complains of unsigned compare against 0. There are 2 cases in
> this function:
> 
> 1821        itp = (irq_holdoff * 1000) / p->desc->qman_256_cycles_per_ns;
> 
> CID 121131 (#1 of 1): Unsigned compared against 0 (NO_EFFECT)
> unsigned_compare: This less-than-zero comparison of an unsigned value is never true. itp < 0U.
> 1822        if (itp < 0 || itp > 4096) {
> 1823                max_holdoff = (p->desc->qman_256_cycles_per_ns * 4096) / 1000;
> 1824                pr_err("irq_holdoff must be between 0..%dus\n", max_holdoff);
> 1825                return -EINVAL;
> 1826        }
> 1827
>     	unsigned_compare: This less-than-zero comparison of an unsigned value is never true. irq_threshold < 0U.
> 1828        if (irq_threshold >= p->dqrr.dqrr_size || irq_threshold < 0) {
> 1829                pr_err("irq_threshold must be between 0..%d\n",
> 1830                       p->dqrr.dqrr_size - 1);
> 1831                return -EINVAL;
> 1832        }
> 
> Fix this by removing the comparisons altogether as they are incorrect. Zero is
> a possible value in either case. Also fix a minor comment typo and update the
> 2 pr_err() calls to use %u formatting as well as be more precise regarding
> the exact error.
> 
> Fixes: ed1d2143fee5 ("soc: fsl: dpio: add support for irq coalescing per software portal")
> Cc: Ioana Ciornei <ioana.ciornei@....com>
> Cc: Roy Pledge <Roy.Pledge@....com>
> Cc: Li Yang <leoyang.li@....com>
> Cc: linux-kernel@...r.kernel.org
> Cc: linuxppc-dev@...ts.ozlabs.org
> Cc: linux-arm-kernel@...ts.infradead.org
> Cc: netdev@...r.kernel.org
> Signed-off-by: Tim Gardner <tim.gardner@...onical.com>

Tested-by: Ioana Ciornei <ioana.ciornei@....com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@....com>

Thanks,

-Ioana

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ