public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Keerthy <j-keerthy@ti.com>, Amit Kucheria <amitk@kernel.org>,
	Zhang Rui <rui.zhang@intel.com>,
	linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] thermal: k3_j72xx_bandgap: Fix array underflow in prep_lookup_table()
Date: Sat, 21 May 2022 09:56:16 +0300	[thread overview]
Message-ID: <20220521065615.GD23160@kadam> (raw)
In-Reply-To: <3061a9fd-5301-4d91-2d60-b85a5d4910e9@linaro.org>

On Fri, May 20, 2022 at 05:25:56PM +0200, Daniel Lezcano wrote:
> On 20/05/2022 17:02, Dan Carpenter wrote:
> > This while loop exits with "i" set to -1 and so then it sets:
> 
> Won't it exit with 'i' set to '0' ?
> 

Wow.  You made me worried there.  I had to make a test case just to be
sure:

        int i = 10;

        while (i--)
                printf("in %d\n", i);
        printf("out %d\n", i);

Yep.  Ends on on -1.

regards,
dan carpenter


  reply	other threads:[~2022-05-21  6:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20 15:02 [PATCH] thermal: k3_j72xx_bandgap: Fix array underflow in prep_lookup_table() Dan Carpenter
2022-05-20 15:25 ` Daniel Lezcano
2022-05-21  6:56   ` Dan Carpenter [this message]
2022-05-21  7:04     ` Dan Carpenter
2022-07-28 15:41 ` [thermal: thermal/next] thermal/drivers/k3_j72xx_bandgap: " thermal-bot for Dan Carpenter

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=20220521065615.GD23160@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=j-keerthy@ti.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox