[PATCH v3 4/5] thermal: rockchip: optimize the conversion table

Eduardo Valentin edubezval at gmail.com
Tue Nov 29 22:29:11 PST 2016


Hey,

On Mon, Nov 28, 2016 at 07:12:03PM +0800, Caesar Wang wrote:

<cut>

> +	num = abs(table->id[mid].code - table->id[mid + 1].code);
> +	num *= temp - table->id[mid].temp;
> +	denom = table->id[mid + 1].temp - table->id[mid].temp;


isn't the above 'mid + 1' off-by-one when mid ends being == table.length - 1?

You would be accessing table->id[table.length], which is wrong memory
access, no?




More information about the Linux-rockchip mailing list