Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] `memcmp()` is called with `ARRAY_SIZE(data_lanes)` instead of `sizeof(data_lanes)`, causing it to compare only the first element of the `u32` array. --
--- Patch [3]: [PATCH v5 3/3] drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support --- commit 5b0901160799f83c03f127b68580169dd845ac90 Author: Wojciech Dubowik <[email protected]> drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support This commit adds support for parsing an optional "data-lanes" device tree property. It allows the driver to configure the ti-sn65dsi83 chip for reversed output LVDS lane order. > diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c > b/drivers/gpu/drm/bridge/ti-sn65dsi83.c > index f8a786953526d..df44df2e872af 100644 > --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c > +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c [ ... ] > @@ -845,6 +863,19 @@ static int sn65dsi83_parse_lvds_endpoint(struct > sn65dsi83 *ctx, int channel) > else > return -EINVAL; > > + ret_data = of_property_read_u32_array(endpoint, "data-lanes", > data_lanes, > + ARRAY_SIZE(data_lanes)); > + if (!ret_data) { > + if (memcmp(data_lanes, > + > supported_data_lane_mapping[LANE_MAPPING_REVERSE], > + ARRAY_SIZE(data_lanes)) == 0) [Severity: Medium] Does this code compare the entire array? memcmp() expects the length in bytes, but ARRAY_SIZE(data_lanes) evaluates to 4 (the number of elements). Because data_lanes is an array of u32, checking only 4 bytes means only the first element is compared. Should this be using sizeof(data_lanes) instead? > + ctx->lvds_reverse_lanes_conf[channel] = true; > + else if (memcmp(data_lanes, > + supported_data_lane_mapping[LANE_MAPPING_NORMAL], > + ARRAY_SIZE(data_lanes)) != 0) [Severity: Medium] The same question applies here. Because only the first element is verified, would an invalid device tree configuration like <4 0 0 0> erroneously match LANE_MAPPING_REVERSE and bypass the expected validation? > + return dev_err_probe(dev, -EINVAL, "invalid data lanes > mapping\n"); > + } > + > ret_data = of_property_read_u32_array(endpoint, > "ti,lvds-vod-swing-data-microvolt", > lvds_vod_swing_data, > ARRAY_SIZE(lvds_vod_swing_data)); -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3
