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

Brahmajit <[email protected]> Tue, 1 Oct 2024 11:48:56 +0530
Newsgroups org.kernel.vger.linux-newbie
Message-ID <sstecaeritl7w2eu5swqmshi5vbvjpeaufwilqdg2jhtnsnpys@iggjwl7wmibo>
On 01.10.2024 11:45, Brahmajit wrote:
> While building the latest stable release with GCC 15 I'm getting an
> build error with (I'm guessing) the drm module. This is probably due to
> combination of GCC 15's introduction of a new warning
> -Wunterminated-string-initialization, -Werror and -Wextra
> 
> In the drivers/gpu/drm/display/drm_dp_dual_mode_helper.c file there is a
> code section on 163
> 
> static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =
> 	"DP-HDMI ADAPTOR\x04";
> 
> Its from the is_hdmi_adaptor() function.
> I read a little about C strings and it seems like we are assigning more
> than 16 characters to the array dp_dual_mode_hdmi_id, and
> DP_DUAL_MODE_HDMI_ID_LEN is defined as 16.
> 
> I'm guessing this has something to do with how termination happens in
> char array vs char* and/or null termination

Some references I found:
- https://lore.kernel.org/linux-btrfs/5mnphkdvheudccjtiatrbjbkqtw54s2wkpeqevj3rqthdqlwyw@sjvn4wn52qki/
- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115185

-- 
Regards,
Brahmajit