mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-04 16:22:09 +00:00
of: overlay: validate offset from property fixups
The smatch static checker marks the data in offset as untrusted, leading it to warn: drivers/of/resolver.c:125 update_usages_of_a_phandle_reference() error: buffer underflow 'prop->value' 's32min-s32max' Add check to verify that offset is within the property data. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Frank Rowand <frank.rowand@sony.com> Cc: <stable@vger.kernel.org> Signed-off-by: Rob Herring <robh@kernel.org>
This commit is contained in:
parent
3b9cf7905f
commit
482137bf2a
@ -122,6 +122,11 @@ static int update_usages_of_a_phandle_reference(struct device_node *overlay,
|
||||
goto err_fail;
|
||||
}
|
||||
|
||||
if (offset < 0 || offset + sizeof(__be32) > prop->length) {
|
||||
err = -EINVAL;
|
||||
goto err_fail;
|
||||
}
|
||||
|
||||
*(__be32 *)(prop->value + offset) = cpu_to_be32(phandle);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user