* [PATCH 1/1] drm/display: Fix building with GCC 15
@ 2024-10-01 14:27 Brahmajit Das
0 siblings, 0 replies; 8+ messages in thread
From: Brahmajit Das @ 2024-10-01 14:27 UTC (permalink / raw)
To: dri-devel; +Cc: ville.syrjala
GCC 15 enables -Werror=unterminated-string-initialization by default.
This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]
164 | "DP-HDMI ADAPTOR\x04";
| ^~~~~~~~~~~~~~~~~~~~~
After discussion with Ville, the fix was to increase the size of
dp_dual_mode_hdmi_id array by one, so that it can accommodate the new
line character. This should let us build the kernel with GCC 15.
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
---
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
index 14a2a8473682..295375868db6 100644
--- a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
@@ -160,11 +160,12 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);
static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN])
{
- static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =
+ //+1 to avaoid spurious -Werror=unterminated-string-initialization warning
+ 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) == 0;
}
static bool is_type1_adaptor(uint8_t adaptor_id)
--
2.46.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/1] drm/display: Fix building with GCC 15
@ 2024-10-01 14:42 Brahmajit Das
2024-10-02 8:26 ` Jani Nikula
0 siblings, 1 reply; 8+ messages in thread
From: Brahmajit Das @ 2024-10-01 14:42 UTC (permalink / raw)
To: dri-devel; +Cc: ville.syrjala
GCC 15 enables -Werror=unterminated-string-initialization by default.
This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]
164 | "DP-HDMI ADAPTOR\x04";
| ^~~~~~~~~~~~~~~~~~~~~
After discussion with Ville, the fix was to increase the size of
dp_dual_mode_hdmi_id array by one, so that it can accommodate the new
line character. This should let us build the kernel with GCC 15.
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
---
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
index 14a2a8473682..295375868db6 100644
--- a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
@@ -160,11 +160,12 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);
static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN])
{
- static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =
+ //+1 to avaoid spurious -Werror=unterminated-string-initialization warning
+ 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) == 0;
}
static bool is_type1_adaptor(uint8_t adaptor_id)
--
2.46.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] drm/display: Fix building with GCC 15
2024-10-01 14:42 [PATCH 1/1] drm/display: Fix building with GCC 15 Brahmajit Das
@ 2024-10-02 8:26 ` Jani Nikula
2024-10-02 9:06 ` [PATCH v2] " Brahmajit Das
2024-10-02 9:50 ` [PATCH 1/1] " Ville Syrjälä
0 siblings, 2 replies; 8+ messages in thread
From: Jani Nikula @ 2024-10-02 8:26 UTC (permalink / raw)
To: Brahmajit Das, dri-devel; +Cc: ville.syrjala
On Tue, 01 Oct 2024, Brahmajit Das <brahmajit.xyz@gmail.com> wrote:
> GCC 15 enables -Werror=unterminated-string-initialization by default.
> This results in the following build error
>
> drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:
> drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
> ‘char’ is too long [-Werror=unterminated-string-initialization]
> 164 | "DP-HDMI ADAPTOR\x04";
> | ^~~~~~~~~~~~~~~~~~~~~
>
> After discussion with Ville, the fix was to increase the size of
> dp_dual_mode_hdmi_id array by one, so that it can accommodate the new
> line character. This should let us build the kernel with GCC 15.
Should be terminating NUL, not new line.
>
> Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
> ---
> drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> index 14a2a8473682..295375868db6 100644
> --- a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> +++ b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> @@ -160,11 +160,12 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);
>
> static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN])
> {
> - static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =
> + //+1 to avaoid spurious -Werror=unterminated-string-initialization warning
If we added comments for every little thing like this, there'd be more
comments than code. ;)
> + 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) == 0;
> }
>
> static bool is_type1_adaptor(uint8_t adaptor_id)
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] drm/display: Fix building with GCC 15
2024-10-02 8:26 ` Jani Nikula
@ 2024-10-02 9:06 ` Brahmajit Das
2024-10-02 9:23 ` [PATCH v3] " Brahmajit Das
2024-10-02 9:50 ` [PATCH 1/1] " Ville Syrjälä
1 sibling, 1 reply; 8+ messages in thread
From: Brahmajit Das @ 2024-10-02 9:06 UTC (permalink / raw)
To: jani.nikula; +Cc: ville.syrjala, dri-devel
GCC 15 enables -Werror=unterminated-string-initialization by default.
This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]
164 | "DP-HDMI ADAPTOR\x04";
| ^~~~~~~~~~~~~~~~~~~~~
After discussion with Ville, the fix was to increase the size of
dp_dual_mode_hdmi_id array by one, so that it can accommodate the new
line character. This should let us build the kernel with GCC 15.
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
---
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
index 14a2a8473682..efb3c3494579 100644
--- a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
@@ -160,11 +160,11 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);
static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN])
{
- static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =
- "DP-HDMI ADAPTOR\x04";
+ static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN + 1] =
+ "DP-HDMI ADAPTOR\x00";
return memcmp(hdmi_id, dp_dual_mode_hdmi_id,
- sizeof(dp_dual_mode_hdmi_id)) == 0;
+ DP_DUAL_MODE_HDMI_ID_LEN) == 0;
}
static bool is_type1_adaptor(uint8_t adaptor_id)
--
2.46.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3] drm/display: Fix building with GCC 15
2024-10-02 9:06 ` [PATCH v2] " Brahmajit Das
@ 2024-10-02 9:23 ` Brahmajit Das
2024-10-02 9:47 ` Jani Nikula
0 siblings, 1 reply; 8+ messages in thread
From: Brahmajit Das @ 2024-10-02 9:23 UTC (permalink / raw)
To: jani.nikula; +Cc: ville.syrjala, dri-devel
GCC 15 enables -Werror=unterminated-string-initialization by default.
This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]
164 | "DP-HDMI ADAPTOR\x04";
| ^~~~~~~~~~~~~~~~~~~~~
After discussion with Ville, the fix was to increase the size of
dp_dual_mode_hdmi_id array by one, so that it can accommodate the NULL
line character. This should let us build the kernel with GCC 15.
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
---
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
index 14a2a8473682..c491e3203bf1 100644
--- a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
@@ -160,11 +160,11 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);
static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN])
{
- 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) == 0;
}
static bool is_type1_adaptor(uint8_t adaptor_id)
--
2.46.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3] drm/display: Fix building with GCC 15
2024-10-02 9:23 ` [PATCH v3] " Brahmajit Das
@ 2024-10-02 9:47 ` Jani Nikula
2024-10-10 12:04 ` Jani Nikula
0 siblings, 1 reply; 8+ messages in thread
From: Jani Nikula @ 2024-10-02 9:47 UTC (permalink / raw)
To: Brahmajit Das; +Cc: ville.syrjala, dri-devel
On Wed, 02 Oct 2024, Brahmajit Das <brahmajit.xyz@gmail.com> wrote:
> GCC 15 enables -Werror=unterminated-string-initialization by default.
> This results in the following build error
>
> drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:
> drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
> ‘char’ is too long [-Werror=unterminated-string-initialization]
> 164 | "DP-HDMI ADAPTOR\x04";
> | ^~~~~~~~~~~~~~~~~~~~~
>
> After discussion with Ville, the fix was to increase the size of
> dp_dual_mode_hdmi_id array by one, so that it can accommodate the NULL
> line character. This should let us build the kernel with GCC 15.
Still s/NULL line/NUL/ but this can be fixed while applying, no need to
resend.
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
> Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
> ---
> drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> index 14a2a8473682..c491e3203bf1 100644
> --- a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> +++ b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> @@ -160,11 +160,11 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);
>
> static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN])
> {
> - 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) == 0;
> }
>
> static bool is_type1_adaptor(uint8_t adaptor_id)
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] drm/display: Fix building with GCC 15
2024-10-02 8:26 ` Jani Nikula
2024-10-02 9:06 ` [PATCH v2] " Brahmajit Das
@ 2024-10-02 9:50 ` Ville Syrjälä
1 sibling, 0 replies; 8+ messages in thread
From: Ville Syrjälä @ 2024-10-02 9:50 UTC (permalink / raw)
To: Jani Nikula; +Cc: Brahmajit Das, dri-devel
On Wed, Oct 02, 2024 at 11:26:10AM +0300, Jani Nikula wrote:
> On Tue, 01 Oct 2024, Brahmajit Das <brahmajit.xyz@gmail.com> wrote:
> > GCC 15 enables -Werror=unterminated-string-initialization by default.
> > This results in the following build error
> >
> > drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:
> > drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
> > ‘char’ is too long [-Werror=unterminated-string-initialization]
> > 164 | "DP-HDMI ADAPTOR\x04";
> > | ^~~~~~~~~~~~~~~~~~~~~
> >
> > After discussion with Ville, the fix was to increase the size of
> > dp_dual_mode_hdmi_id array by one, so that it can accommodate the new
> > line character. This should let us build the kernel with GCC 15.
>
> Should be terminating NUL, not new line.
>
> >
> > Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
> > ---
> > drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> > index 14a2a8473682..295375868db6 100644
> > --- a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> > +++ b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
> > @@ -160,11 +160,12 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);
> >
> > static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN])
> > {
> > - static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =
> > + //+1 to avaoid spurious -Werror=unterminated-string-initialization warning
>
> If we added comments for every little thing like this, there'd be more
> comments than code. ;)
I asked for a comment, otherwise I suspect I''d end up undoing this
after forgetting why it's there. OTOH maybe I'll get the "broken"
gcc upgrade before I look at this code again, which would solve
that particular problem.
>
> > + 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) == 0;
> > }
> >
> > static bool is_type1_adaptor(uint8_t adaptor_id)
>
> --
> Jani Nikula, Intel
--
Ville Syrjälä
Intel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] drm/display: Fix building with GCC 15
2024-10-02 9:47 ` Jani Nikula
@ 2024-10-10 12:04 ` Jani Nikula
0 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2024-10-10 12:04 UTC (permalink / raw)
To: Brahmajit Das; +Cc: ville.syrjala, dri-devel
On Wed, 02 Oct 2024, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Wed, 02 Oct 2024, Brahmajit Das <brahmajit.xyz@gmail.com> wrote:
>> GCC 15 enables -Werror=unterminated-string-initialization by default.
>> This results in the following build error
>>
>> drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:
>> drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
>> ‘char’ is too long [-Werror=unterminated-string-initialization]
>> 164 | "DP-HDMI ADAPTOR\x04";
>> | ^~~~~~~~~~~~~~~~~~~~~
>>
>> After discussion with Ville, the fix was to increase the size of
>> dp_dual_mode_hdmi_id array by one, so that it can accommodate the NULL
>> line character. This should let us build the kernel with GCC 15.
>
> Still s/NULL line/NUL/ but this can be fixed while applying, no need to
> resend.
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Pushed to drm-misc-next, and forgot to update the commit message. Oh
well. My bad.
Thanks for the patch.
BR,
Jani.
>
>
>>
>> Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
>> ---
>> drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
>> index 14a2a8473682..c491e3203bf1 100644
>> --- a/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
>> +++ b/drivers/gpu/drm/display/drm_dp_dual_mode_helper.c
>> @@ -160,11 +160,11 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);
>>
>> static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN])
>> {
>> - 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) == 0;
>> }
>>
>> static bool is_type1_adaptor(uint8_t adaptor_id)
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-10-10 12:04 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-01 14:42 [PATCH 1/1] drm/display: Fix building with GCC 15 Brahmajit Das
2024-10-02 8:26 ` Jani Nikula
2024-10-02 9:06 ` [PATCH v2] " Brahmajit Das
2024-10-02 9:23 ` [PATCH v3] " Brahmajit Das
2024-10-02 9:47 ` Jani Nikula
2024-10-10 12:04 ` Jani Nikula
2024-10-02 9:50 ` [PATCH 1/1] " Ville Syrjälä
-- strict thread matches above, loose matches on Subject: below --
2024-10-01 14:27 Brahmajit Das
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).