All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Luis Chamberlain <mcgrof@kernel.org>,
	Jakob Koschel <jakobkoschel@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Russ Weight <russell.h.weight@intel.com>,
	Tianfei zhang <tianfei.zhang@intel.com>,
	Lee Jones <lee.jones@linaro.org>,
	Shawn Guo <shawn.guo@linaro.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] test_firmware: fix end of loop test in upload_read_show()
Date: Wed, 11 May 2022 14:41:40 +0300	[thread overview]
Message-ID: <20220511114139.GH4009@kadam> (raw)
In-Reply-To: <YnmXhaSMqi5k7KV7@bombadil.infradead.org>

On Mon, May 09, 2022 at 03:36:53PM -0700, Luis Chamberlain wrote:
> > This test is reading out of bounds.  Another fix would be to write it
> > as:
> > 
> > 	if (list_entry_is_head(tst, &test_upload_list, node)) {
> > 
> > But there is a desire to make it impossible to access the list iterator
> > outside the loop.  Linus was drafting alternative list macros but I
> > don't know the status of that.
> 
> Fine to get these fixes merged, but it would seem test firmware
> would be low on the list of places to fix. Either way I'm happy
> for this to go in.
> 

I'm just fixing new static checker bugs as they are added, but you
made me curiuos to see if there were old known bugs still.

The following functions are still buggy:
wd719x_interrupt()
nvkm_clk_ustate_update()

Most of the others are Smatch false positives, but some are a bit tricky
and I'm not sure either way.  I marked them as false positives if the
author seemed confident that no end of loop test was required.

Bugs:
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c:489 nvkm_clk_ustate_update() warn: iterator used outside loop: 'pstate'
drivers/scsi/wd719x.c:691 wd719x_interrupt() warn: iterator used outside loop: 'scb'
lib/test_firmware.c:1408 upload_read_show() warn: iterator used outside loop: 'tst'

Tricky:
drivers/net/ethernet/mellanox/mlx4/alloc.c:379 __mlx4_alloc_from_zone() warn: iterator used outside loop: 'curr_node'

False positives:
drivers/usb/host/uhci-q.c:466 link_async() warn: iterator used outside loop: 'pqh'
drivers/infiniband/core/mad.c:968 ib_get_rmpp_segment() warn: iterator used outside loop: 'mad_send_wr->cur_seg'
drivers/infiniband/hw/hfi1/tid_rdma.c:1280 kern_alloc_tids() warn: iterator used outside loop: 'group'
drivers/staging/rtl8192e/rtl819x_TSProc.c:260 SearchAdmitTRStream() warn: iterator used outside loop: 'pRet'
drivers/perf/xgene_pmu.c:1487 acpi_get_pmu_hw_inf() warn: iterator used outside loop: 'rentry'
drivers/perf/thunderx2_pmu.c:814 tx2_uncore_pmu_init_dev() warn: iterator used outside loop: 'rentry'
drivers/gpu/drm/vc4/vc4_dsi.c:769 vc4_dsi_encoder_disable() warn: iterator used outside loop: 'iter'
drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c:111 nvkm_control_mthd_pstate_attr() warn: iterator used outside loop: 'pstate'
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c:283 nvkm_pstate_prog() warn: iterator used outside loop: 'pstate'
drivers/gpu/drm/panfrost/panfrost_mmu.c:203 panfrost_mmu_as_get() warn: iterator used outside loop: 'lru_mmu'
drivers/net/wireless/ath/ath6kl/htc_mbox.c:107 ath6kl_credit_init() warn: iterator used outside loop: 'cur_ep_dist'
net/xfrm/xfrm_ipcomp.c:246 ipcomp_free_tfms() warn: iterator used outside loop: 'pos'

regards,
dan carpenter


      reply	other threads:[~2022-05-11 11:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 10:29 [PATCH] test_firmware: fix end of loop test in upload_read_show() Dan Carpenter
2022-05-05 12:39 ` Luis Chamberlain
2022-05-05 13:02   ` Dan Carpenter
2022-05-09 22:36     ` Luis Chamberlain
2022-05-11 11:41       ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220511114139.GH4009@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jakobkoschel@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=russell.h.weight@intel.com \
    --cc=shawn.guo@linaro.org \
    --cc=tianfei.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.