On Tue, Oct 01, 2024 at 07:18:23PM +0530, Brahmajit wrote: > On 01.10.2024 16:28, Ville Syrjälä wrote: > > Looks like gcc is warning about perfectly legal code > > (as far as the C standard goes). > > > > But we could work around by adding room for the '\0' and > > s/sizeof(...)/DP_DUAL_MODE_HDMI_ID_LEN/ in the memcmp(). > > Sorry I'm new, but can we do something like this? > > --- a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c > +++ b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c > @@ -158,13 +158,13 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, > } > EXPORT_SYMBOL(drm_dp_dual_mode_write); > > -static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN]) > +static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN+1]) This should not have the +1 > { > - static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] = > + static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN+1] = > "DP-HDMI ADAPTOR\x04"; > > return memcmp(hdmi_id, dp_dual_mode_hdmi_id, > - sizeof(dp_dual_mode_hdmi_id)) == 0; > + DP_DUAL_MODE_HDMI_ID_LEN+1) == 0; and neither should this > } > > static bool is_type1_adaptor(uint8_t adaptor_id) > > -- > Regards, > Brahmajit -- Ville Syrjälä Intel