Skip to content

Commit

Permalink
i3c: Fix the verification of random PID
Browse files Browse the repository at this point in the history
The validation of random PID should be done by checking the
boardinfo->pid instead of info.pid which is empty.

Doing the change the info struture declaration is no longer necessary.

Cc: Boris Brezillon <bbrezillon@kernel.org>
Cc: <stable@vger.kernel.org>
Fixes: 3a379bb ("i3c: Add core I3C infrastructure")
Signed-off-by: Vitor Soares <vitor.soares@synopsys.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
  • Loading branch information
vitor-soares-snps authored and bbrezillon committed Apr 10, 2019
1 parent 15ade5d commit 9752c37
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/i3c/master.c
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,6 @@ of_i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master,
{
struct i3c_dev_boardinfo *boardinfo;
struct device *dev = &master->dev;
struct i3c_device_info info = { };
enum i3c_addr_slot_status addrstatus;
u32 init_dyn_addr = 0;

Expand Down Expand Up @@ -2012,8 +2011,8 @@ of_i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master,

boardinfo->pid = ((u64)reg[1] << 32) | reg[2];

if ((info.pid & GENMASK_ULL(63, 48)) ||
I3C_PID_RND_LOWER_32BITS(info.pid))
if ((boardinfo->pid & GENMASK_ULL(63, 48)) ||
I3C_PID_RND_LOWER_32BITS(boardinfo->pid))
return -EINVAL;

boardinfo->init_dyn_addr = init_dyn_addr;
Expand Down

0 comments on commit 9752c37

Please sign in to comment.