diff options
author | Martin Roth <martinroth@chromium.org> | 2016-08-12 11:56:50 -0600 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-23 15:37:13 -0700 |
commit | 681284ca22897088613247406ae4ee9e0e19f38c (patch) | |
tree | 7428b677e3c6306b816c42558eb82722daac185f /board/honeybuns/usb_mux.c | |
parent | aee8407f4e62efefb944f9050de7ae80032b4651 (diff) | |
download | chrome-ec-681284ca22897088613247406ae4ee9e0e19f38c.tar.gz |
npcx/i2c.c: Verify that controller value is not negative before using it
The function i2c_port_to_controller() returns a negative value if
the port value was out of range. This wasn't being checked before the
controller value was getting used which could lead to using an invalid
value as a pointer to a structure.
This returns an error where it makes sense, and just ignores the
incorrect value otherwise.
TEST=Build
BUG=None
BRANCH=None
Change-Id: Ie8967bc4db87d3dd1863a2e36e35ac87e6161132
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/371400
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Diffstat (limited to 'board/honeybuns/usb_mux.c')
0 files changed, 0 insertions, 0 deletions