[openib-general] [PATCH 7/13] osm: port to WinIB stack : opensm/osm_ucast_file.c

Sasha Khapyorsky sashak at voltaire.com
Tue Oct 3 15:01:55 PDT 2006


Hi Eitan,

On 21:25 Tue 03 Oct     , Eitan Zahavi wrote:
> Hi Hal,
> 
> This is another case where Michael complains about the patch not 
> providing range checking.
> However, range checking is not implemented for the rest of this parser 
> code.

There are only two occurrences of strtoul() in this parser and both are
touched by the patch.

BTW what is the goal of int/int casting in this and other WinIB patches?
VC warnings preventing?

It does not help to make the code more readable and potentially could
hide a problems.

Sasha

> So I think
> the range check should be a separate patch.
> 
> Please let me know if this works for you
> 
> Thanks
> 
> 
> Michael S. Tsirkin wrote:
> 
> >Quoting r. Eitan Zahavi <eitan at mellanox.co.il>:
> >  
> >
> >> 				p++;
> >>-			port_num = strtoul(p, &q, 10);
> >>+			port_num = (uint8_t)strtoul(p, &q, 10);
> >> 			if (q && !isspace(*q)) {
> >>    
> >>
> >
> >Would it make sense to range-check the value before casting it away?
> >  
> >
> 
> 
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
> 




More information about the general mailing list