[squid-dev] [PATCH] Coverity-fixes, part 1: EnumIterator

Kinkie gkinkie at gmail.com
Thu Aug 27 09:51:04 UTC 2015


On Wed, Aug 26, 2015 at 9:44 PM, Amos Jeffries <squid3 at treenet.co.nz> wrote:

> On 27/08/2015 6:19 a.m., Alex Rousskov wrote:
> > On 08/26/2015 11:04 AM, Kinkie wrote:
> >
> >> v2 patch attached.
> >
> > FYI: If you have missed my last email on this thread, it is archived at
> > http://lists.squid-cache.org/pipermail/squid-dev/2015-August/003173.html
> >
> > Alex.
> >
>
> Also,
>
> Please double-triple-check that your new awk code works on all files its
> been processing so far. Some of them are in other sub-directories and
> IIRC the reason it was not using END already was that it sometimes had
> to process multiple enum types from a single file.
>

Checked all. They are 100% identical.


> in src/neighbors.cc the range-for loop in the hunk @1607 should be a
> WholeEnum right?
>

Yes. Changed.


> I dont see any special-case requiring ICP_END to stay in existence. All
> I see is it being used to check for out-of-range values being received
> in the packet opcode field.
>

Already said in IRC, but reporting here for others and for the record:
In CachePeer.h: CachePeer.h: int counts[ICP_END+1];
and in neighbor.cc:neighborAlive  if ((icp_opcode) header->opcode <=
ICP_END)

ICP_END is counted as a kind of "no match, for opcode" token. As you
mentioned,  the report loop uses (op < ICP_END) for display so either the
report loop is wrong or the counting is useless.

 In which case the value ICP_END itelf should be included as an invalid

> value; yes? or if END is an opcode why is it not being reported in the
> stats with enumEnd_ a value past it?
>
> Or perhapse this is simply showing the lack of an explicit isItValid()
> check in the API design.
>


I suspect that this is the case. Not addressing it here, as it's out of
scope.
Attaching patch in two parts: Makefile.am and everything else.


Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150827/46f62bac/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coverity-fixes-enumiterator-makefileam.patch
Type: application/octet-stream
Size: 933 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150827/46f62bac/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coverity-fixes-enumiterator-v3.patch
Type: application/octet-stream
Size: 28362 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150827/46f62bac/attachment-0003.obj>


More information about the squid-dev mailing list