Re: Build failure with GCC 15 in drivers/gpu/drm/display/drm_dp_dual_mode_helper.c

Brahmajit <[email protected]> Tue, 1 Oct 2024 19:18:23 +0530
Newsgroups org.kernel.vger.linux-newbie
Message-ID <cnx7qachu5f5oeqvovgikh53xbzvdy6qigfj6oukp7wazvmwtz@gumangbeu42d>
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])
 {
-	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;
 }
 
 static bool is_type1_adaptor(uint8_t adaptor_id)

-- 
Regards,
Brahmajit