mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
nvidia-oot: cdi: Update cdi package buf size check
The original checking for cdi_dev_package buffer size is wrong, it should not check the max size against max I2C payload size. If the cdi_dev_package buffer size is too big for i2c transfer, it will be breaking down to smaller sizes and transferred using multiple I2C messages. Define a new MAX_CDI_DEV_PACKAGE_BUFFER_SIZE for checking the cdi_dev_package buffer size. Bug 5107765 Jira CAMERASW-333779 Change-Id: Ieec049d51af4911dfd31410f43aa4733b75d265d Signed-off-by: Frank Chen <frankc@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3365281 Reviewed-by: Kevin Xie (SW-TEGRA) <kevixie@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Ganesh Ram Savithri Sreenivas Murthy <ganeshrams@nvidia.com> Reviewed-by: Samuel Hung <samuelh@nvidia.com>
This commit is contained in:
@@ -23,7 +23,8 @@
|
|||||||
|
|
||||||
/* i2c payload size is only 12 bit */
|
/* i2c payload size is only 12 bit */
|
||||||
#define MAX_MSG_SIZE (0xFFF - 1)
|
#define MAX_MSG_SIZE (0xFFF - 1)
|
||||||
|
/* max buffer size for cdi_dev_package */
|
||||||
|
#define MAX_CDI_DEV_PACKAGE_BUFFER_SIZE (0xFFFF - 1)
|
||||||
/*#define DEBUG_I2C_TRAFFIC*/
|
/*#define DEBUG_I2C_TRAFFIC*/
|
||||||
|
|
||||||
/* CDI Dev Debugfs functions
|
/* CDI Dev Debugfs functions
|
||||||
@@ -377,7 +378,7 @@ static int cdi_dev_get_package(
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!info->rw_pkg.size || info->rw_pkg.size > MAX_MSG_SIZE) {
|
if (!info->rw_pkg.size || info->rw_pkg.size > MAX_CDI_DEV_PACKAGE_BUFFER_SIZE) {
|
||||||
dev_err(info->dev, "%s invalid package size %d\n",
|
dev_err(info->dev, "%s invalid package size %d\n",
|
||||||
__func__, info->rw_pkg.size);
|
__func__, info->rw_pkg.size);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user