Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nvmem: imx-ocotp-ele: simplify read beyond device check

Do the read beyond device check on function entry in bytes instead of
32bit words which is easier to follow.

Fixes: 22e9e6fcfb50 ("nvmem: imx: support i.MX93 OCOTP")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: stable <stable@kernel.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20241230141901.263976-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sascha Hauer and committed by
Greg Kroah-Hartman
343aa1e2 5bd97a54

+3 -3
+3 -3
drivers/nvmem/imx-ocotp-ele.c
··· 72 72 void *p; 73 73 int i; 74 74 75 + if (offset + bytes > priv->data->size) 76 + bytes = priv->data->size - offset; 77 + 75 78 index = offset; 76 79 num_bytes = round_up(bytes, 4); 77 80 count = num_bytes >> 2; 78 - 79 - if (count > ((priv->data->size >> 2) - index)) 80 - count = (priv->data->size >> 2) - index; 81 81 82 82 p = kzalloc(num_bytes, GFP_KERNEL); 83 83 if (!p)