Re: [PATCH 01/10] sched/topology: introduce for_each_numa_hop_node() / sched_numa_hop_node()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > > + */
> > > +int sched_numa_hop_node(nodemask_t *hop_nodes, int start, unsigned int state)
> > > +{
> > > +	int dist, n, min_node, min_dist;
> > > +
> > > +	if (state >= NR_NODE_STATES)
> > > +		return NUMA_NO_NODE;
> > 
> >  -EINVAL. But, do we need to check the parameter at all?
> 
> numa_nearest_node() has the same check (returning -EINVAL), it seems sane
> to do this check here as well to prevent out-of-bounds access to
> node_states[state].

And I don't think we need to check state in there.

numa_nearest_node() can probably explain it because it's an exported
function. But your sched_numa_hop_node() is an entirely in-kernel thing.
Kernel functions don't check parameters.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux