[PATCH] i3c: master: require dests for read CCC commands
Frank Li
Frank.li at oss.nxp.com
Thu Jul 23 11:17:31 PDT 2026
On Thu, Jul 23, 2026 at 05:23:10PM +0800, Adrian Ng Ho Yin wrote:
> Read CCC commands (rnw set) always need a destination array to store
> payload data. Extend the existing direct-CCC validation so cmd->dests
> is guaranteed non-NULL when cmd->rnw is set.
>
> Reported-by: kernel test robot <lkp at intel.com>
> Reported-by: Dan Carpenter <error27 at gmail.com>
> Closes: https://lore.kernel.org/r/202607222347.TXH6r6ie-lkp@intel.com/
> Signed-off-by: Adrian Ng Ho Yin <adrian.ho.yin.ng at altera.com>
> ---
Reviewed-by: Frank Li <Frank.Li at nxp.com>
> drivers/i3c/master.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index fd3e79d10c84..0249886d319b 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -1039,7 +1039,8 @@ static int i3c_master_send_ccc_cmd_locked(struct i3c_master_controller *master,
> if (!master->ops->send_ccc_cmd)
> return -EOPNOTSUPP;
>
> - if ((cmd->id & I3C_CCC_DIRECT) && (!cmd->dests || !cmd->ndests))
> + if ((cmd->rnw || (cmd->id & I3C_CCC_DIRECT)) &&
> + (!cmd->dests || !cmd->ndests))
> return -EINVAL;
>
> if (master->ops->supports_ccc_cmd &&
> --
> 2.49.GIT
>
More information about the linux-i3c
mailing list