<br><div class="gmail_quote">2011/9/13 Charles Lepple <span dir="ltr"><<a href="mailto:clepple@gmail.com">clepple@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word">Rich,<div><br></div><div>Thanks for submitting this patch.</div><div><br></div><div>One small thing I noticed on the Solaris buildbot:</div><div><br></div><div><pre><span>../../drivers/bcmxcp.c: In function `setvar':
../../drivers/bcmxcp.c:1733: warning: comparison is always false due to limited range of data type
</span><span></span></pre><pre><span>The code:</span></pre><pre>int setvar (const char *varname, const char *val)
{</pre><pre>[...]</pre><pre><span style="font-family:Helvetica;white-space:normal"> </span><span style="font-family:Helvetica;white-space:normal"><font face="monospace"><span style="white-space:pre-wrap">int16_t sec; /* limit the size of the timer, to avoid overflow */</span></font></span><span style="font-family:Helvetica;white-space:normal"> </span></pre>
<pre>[...]</pre><pre> sec = atoi(val);
/* Check value:
* 0-32767 are valid values
* -1 means no Automatic off or restart
* for Auto Off Delay:
* 0-30 are valid but ill-advised */
if (sec < -1 || sec > 0x7FFF) {
return STAT_SET_INVALID;
}
</pre></div><div><br></div><div>I think the value of atoi() should probably be assigned to a larger int variable, and leave the conditional there to guard against out-of-range values.</div></div></blockquote></div><br>my fault: the int16_t was a try to limit out-of-range before reaching this.<br>
I also noticed it while working on the BB issues, so I'll revert it now.<br><br>thanks for pointing it.<br>Arnaud<br clear="all">-- <br>Linux / Unix Expert R&D - Eaton - <a href="http://powerquality.eaton.com" target="_blank">http://powerquality.eaton.com</a><br>
Network UPS Tools (NUT) Project Leader - <a href="http://www.networkupstools.org/" target="_blank">http://www.networkupstools.org/</a><br>Debian Developer - <a href="http://www.debian.org" target="_blank">http://www.debian.org</a><br>
Free Software Developer - <a href="http://arnaud.quette.free.fr/" target="_blank">http://arnaud.quette.free.fr/</a><br><br>