From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: linux-watchdog@vger.kernel.org
Subject: re: watchdog: Convert wm831x driver to watchdog core
Date: Fri, 4 Nov 2011 21:44:58 +0300 [thread overview]
Message-ID: <20111104184458.GA6650@elgon.mountain> (raw)
Hi Mark,
Smatch complains about 21cef54c0b1 "watchdog: Convert wm831x driver
to watchdog core"
drivers/watchdog/wm831x_wdt.c +159 wm831x_wdt_set_timeout(17)
error: buffer overflow 'wm831x_wdt_cfgs' 7 <= 7
142 static int wm831x_wdt_set_timeout(struct watchdog_device *wdt_dev,
143 unsigned int timeout)
144 {
145 struct wm831x_wdt_drvdata *driver_data = watchdog_get_drvdata(wdt_dev);
146 struct wm831x *wm831x = driver_data->wm831x;
147 int ret, i;
148
149 for (i = 0; i < ARRAY_SIZE(wm831x_wdt_cfgs); i++)
150 if (wm831x_wdt_cfgs[i].time == timeout)
151 break;
152 if (i == ARRAY_SIZE(wm831x_wdt_cfgs))
153 ret = -EINVAL;
^^^^^^^^^^^^^^
We overwrite this return value on the next line. I don't know the
code well enough to say if the intent was to return directly or to
unlock first and then return.
154
155 ret = wm831x_reg_unlock(wm831x);
regards,
dan carpenter
reply other threads:[~2011-11-04 18:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20111104184458.GA6650@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-watchdog@vger.kernel.org \
/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