<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 5, 2021, 9:08 AM Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Mar 4, 2021 at 12:50 PM Ryan Long <<a href="mailto:thisisryanlong@gmail.com" target="_blank" rel="noreferrer">thisisryanlong@gmail.com</a>> wrote:<br>
><br>
> CID 1399768: Unsigned compared against 0 in satcan_ioctl().<br>
><br>
> Closes #4294<br>
> ---<br>
> bsps/shared/grlib/can/satcan.c | 16 ++++------------<br>
> 1 file changed, 4 insertions(+), 12 deletions(-)<br>
><br>
> diff --git a/bsps/shared/grlib/can/satcan.c b/bsps/shared/grlib/can/satcan.c<br>
> index c3fdc15..52e674c 100644<br>
> --- a/bsps/shared/grlib/can/satcan.c<br>
> +++ b/bsps/shared/grlib/can/satcan.c<br>
> @@ -239,9 +239,7 @@ static rtems_device_driver satcan_ioctl(rtems_device_major_number major, rtems_d<br>
> /* Get regmod structure from argument */<br>
> regmod = (satcan_regmod*)ioarg->buffer;<br>
> DBG("SatCAN: ioctl: getting register %d\n\r", regmod->reg);<br>
should these DBG prints also be changed to %u?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Probably. Can this be put on his todo list? Enable the debug prints in grlib and see what printf format specifier warnings come out?</div><div dir="auto"><br></div><div dir="auto">This would seem to be the most reliable way to catch them all.</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> - if (regmod->reg < 0)<br>
> - return RTEMS_INVALID_NAME;<br>
> - else if (regmod->reg <= SATCAN_FILTER_STOP)<br>
> + if (regmod->reg <= SATCAN_FILTER_STOP)<br>
> regmod->val = regs->satcan[regmod->reg];<br>
> else if (regmod->reg == SATCAN_WCTRL)<br>
> regmod->val = regs->ctrl;<br>
> @@ -260,9 +258,7 @@ static rtems_device_driver satcan_ioctl(rtems_device_major_number major, rtems_d<br>
> regmod = (satcan_regmod*)ioarg->buffer;<br>
> DBG("SatCAN: ioctl: setting register %d, value %x\n\r",<br>
> regmod->reg, regmod->val);<br>
> - if (regmod->reg < 0)<br>
> - return RTEMS_INVALID_NAME;<br>
> - else if (regmod->reg <= SATCAN_FILTER_STOP)<br>
> + if (regmod->reg <= SATCAN_FILTER_STOP)<br>
> regs->satcan[regmod->reg] = regmod->val;<br>
> else if (regmod->reg == SATCAN_WCTRL)<br>
> regs->ctrl = regmod->val;<br>
> @@ -281,9 +277,7 @@ static rtems_device_driver satcan_ioctl(rtems_device_major_number major, rtems_d<br>
> regmod = (satcan_regmod*)ioarg->buffer;<br>
> DBG("SatCAN: ioctl: or:ing register %d, with value %x\n\r",<br>
> regmod->reg, regmod->val);<br>
> - if (regmod->reg < 0)<br>
> - return RTEMS_INVALID_NAME;<br>
> - else if (regmod->reg <= SATCAN_FILTER_STOP)<br>
> + if (regmod->reg <= SATCAN_FILTER_STOP)<br>
> regs->satcan[regmod->reg] |= regmod->val;<br>
> else if (regmod->reg == SATCAN_WCTRL)<br>
> regs->ctrl |= regmod->val;<br>
> @@ -302,9 +296,7 @@ static rtems_device_driver satcan_ioctl(rtems_device_major_number major, rtems_d<br>
> regmod = (satcan_regmod*)ioarg->buffer;<br>
> DBG("SatCAN: ioctl: masking register %d, with value %x\n\r",<br>
> regmod->reg, regmod->val);<br>
> - if (regmod->reg < 0)<br>
> - return RTEMS_INVALID_NAME;<br>
> - else if (regmod->reg <= SATCAN_FILTER_STOP)<br>
> + if (regmod->reg <= SATCAN_FILTER_STOP)<br>
> regs->satcan[regmod->reg] &= regmod->val;<br>
> else if (regmod->reg == SATCAN_WCTRL)<br>
> regs->ctrl &= regmod->val;<br>
> --<br>
> 1.8.3.1<br>
><br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank" rel="noreferrer">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank" rel="noreferrer">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div></div>