mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <>
To: "" <>
Subject: [BUG] mtd: cfi-flash: comparison of unsigned expression in '>= 0' is always true
Date: Mon, 17 May 2021 13:29:05 +0200
Message-ID: <> (raw)


The new warning correctly flags following piece of code in

/* loop through the sectors from the highest address
 * when the passed address is greater or equal to the sector address
 * we have a match
flash_sect_t find_sector(struct flash_info *info, unsigned long addr)
        flash_sect_t sector;

        for (sector = info->sector_count - 1; sector >= 0; sector--) {
                if (addr >= info->start[sector])

        return sector;

If addr is indeed unmapped by info->start[*], this would be an infinite
loop. I don't know what the correct fix would be though. Any suggestions?


Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       |  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

barebox mailing list

             reply	other threads:[~2021-05-17 11:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 11:29 Ahmad Fatoum [this message]
2021-05-18  6:26 ` Sascha Hauer

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:

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

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ \
	public-inbox-index barebox

Example config snippet for mirrors.

AGPL code for this site: git clone