dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Fix return type of mode_valid function hook
@ 2022-09-13 20:55 Nathan Huckleberry
  2022-09-13 23:19 ` Nathan Chancellor
  2022-09-14 13:47 ` [Intel-gfx] " Andrzej Hajda
  0 siblings, 2 replies; 4+ messages in thread
From: Nathan Huckleberry @ 2022-09-13 20:55 UTC (permalink / raw)
  Cc: Lucas De Marchi, Tvrtko Ursulin, llvm, Dan Carpenter,
	David Airlie, Tom Rix, intel-gfx, Nick Desaulniers, linux-kernel,
	Nathan Huckleberry, Nathan Chancellor, dri-devel, Rodrigo Vivi

All of the functions used for intel_dvo_dev_ops.mode_valid have a return
type of enum drm_mode_status, but the mode_valid field in the struct
definition has a return type of int.

The mismatched return type breaks forward edge kCFI since the underlying
function definitions do not match the function hook definition.

The return type of the mode_valid field should be changed from int to
enum drm_mode_status.

Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://github.com/ClangBuiltLinux/linux/issues/1703
Cc: llvm@lists.linux.dev
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
---
 drivers/gpu/drm/i915/display/intel_dvo_dev.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dvo_dev.h b/drivers/gpu/drm/i915/display/intel_dvo_dev.h
index d96c3cc46e50..50205f064d93 100644
--- a/drivers/gpu/drm/i915/display/intel_dvo_dev.h
+++ b/drivers/gpu/drm/i915/display/intel_dvo_dev.h
@@ -75,8 +75,8 @@ struct intel_dvo_dev_ops {
 	 *
 	 * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
 	 */
-	int (*mode_valid)(struct intel_dvo_device *dvo,
-			  struct drm_display_mode *mode);
+	enum drm_mode_status (*mode_valid)(struct intel_dvo_device *dvo,
+					   struct drm_display_mode *mode);
 
 	/*
 	 * Callback for preparing mode changes on an output
-- 
2.37.2.789.g6183377224-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Fix return type of mode_valid function hook
  2022-09-13 20:55 [PATCH] drm/i915: Fix return type of mode_valid function hook Nathan Huckleberry
@ 2022-09-13 23:19 ` Nathan Chancellor
  2022-09-15  7:39   ` Jani Nikula
  2022-09-14 13:47 ` [Intel-gfx] " Andrzej Hajda
  1 sibling, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2022-09-13 23:19 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: Lucas De Marchi, Tvrtko Ursulin, llvm, Dan Carpenter,
	David Airlie, Tom Rix, intel-gfx, Nick Desaulniers, linux-kernel,
	dri-devel, Rodrigo Vivi

On Tue, Sep 13, 2022 at 01:55:27PM -0700, Nathan Huckleberry wrote:
> All of the functions used for intel_dvo_dev_ops.mode_valid have a return
> type of enum drm_mode_status, but the mode_valid field in the struct
> definition has a return type of int.
> 
> The mismatched return type breaks forward edge kCFI since the underlying
> function definitions do not match the function hook definition.
> 
> The return type of the mode_valid field should be changed from int to
> enum drm_mode_status.
> 
> Reported-by: Dan Carpenter <error27@gmail.com>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1703
> Cc: llvm@lists.linux.dev
> Signed-off-by: Nathan Huckleberry <nhuck@google.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  drivers/gpu/drm/i915/display/intel_dvo_dev.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dvo_dev.h b/drivers/gpu/drm/i915/display/intel_dvo_dev.h
> index d96c3cc46e50..50205f064d93 100644
> --- a/drivers/gpu/drm/i915/display/intel_dvo_dev.h
> +++ b/drivers/gpu/drm/i915/display/intel_dvo_dev.h
> @@ -75,8 +75,8 @@ struct intel_dvo_dev_ops {
>  	 *
>  	 * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
>  	 */
> -	int (*mode_valid)(struct intel_dvo_device *dvo,
> -			  struct drm_display_mode *mode);
> +	enum drm_mode_status (*mode_valid)(struct intel_dvo_device *dvo,
> +					   struct drm_display_mode *mode);
>  
>  	/*
>  	 * Callback for preparing mode changes on an output
> -- 
> 2.37.2.789.g6183377224-goog
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915: Fix return type of mode_valid function hook
  2022-09-13 20:55 [PATCH] drm/i915: Fix return type of mode_valid function hook Nathan Huckleberry
  2022-09-13 23:19 ` Nathan Chancellor
@ 2022-09-14 13:47 ` Andrzej Hajda
  1 sibling, 0 replies; 4+ messages in thread
From: Andrzej Hajda @ 2022-09-14 13:47 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: Nick Desaulniers, Dan Carpenter, David Airlie, Tom Rix,
	intel-gfx, llvm, Lucas De Marchi, linux-kernel, dri-devel,
	Nathan Chancellor, Rodrigo Vivi

On 13.09.2022 22:55, Nathan Huckleberry wrote:
> All of the functions used for intel_dvo_dev_ops.mode_valid have a return
> type of enum drm_mode_status, but the mode_valid field in the struct
> definition has a return type of int.
> 
> The mismatched return type breaks forward edge kCFI since the underlying
> function definitions do not match the function hook definition.
> 
> The return type of the mode_valid field should be changed from int to
> enum drm_mode_status.
> 
> Reported-by: Dan Carpenter <error27@gmail.com>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1703
> Cc: llvm@lists.linux.dev
> Signed-off-by: Nathan Huckleberry <nhuck@google.com>

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej

> ---
>   drivers/gpu/drm/i915/display/intel_dvo_dev.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dvo_dev.h b/drivers/gpu/drm/i915/display/intel_dvo_dev.h
> index d96c3cc46e50..50205f064d93 100644
> --- a/drivers/gpu/drm/i915/display/intel_dvo_dev.h
> +++ b/drivers/gpu/drm/i915/display/intel_dvo_dev.h
> @@ -75,8 +75,8 @@ struct intel_dvo_dev_ops {
>   	 *
>   	 * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
>   	 */
> -	int (*mode_valid)(struct intel_dvo_device *dvo,
> -			  struct drm_display_mode *mode);
> +	enum drm_mode_status (*mode_valid)(struct intel_dvo_device *dvo,
> +					   struct drm_display_mode *mode);
>   
>   	/*
>   	 * Callback for preparing mode changes on an output


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Fix return type of mode_valid function hook
  2022-09-13 23:19 ` Nathan Chancellor
@ 2022-09-15  7:39   ` Jani Nikula
  0 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2022-09-15  7:39 UTC (permalink / raw)
  To: Nathan Chancellor, Nathan Huckleberry
  Cc: Lucas De Marchi, Tvrtko Ursulin, llvm, Dan Carpenter,
	David Airlie, Tom Rix, intel-gfx, Nick Desaulniers, linux-kernel,
	dri-devel, Rodrigo Vivi

On Tue, 13 Sep 2022, Nathan Chancellor <nathan@kernel.org> wrote:
> On Tue, Sep 13, 2022 at 01:55:27PM -0700, Nathan Huckleberry wrote:
>> All of the functions used for intel_dvo_dev_ops.mode_valid have a return
>> type of enum drm_mode_status, but the mode_valid field in the struct
>> definition has a return type of int.
>> 
>> The mismatched return type breaks forward edge kCFI since the underlying
>> function definitions do not match the function hook definition.
>> 
>> The return type of the mode_valid field should be changed from int to
>> enum drm_mode_status.
>> 
>> Reported-by: Dan Carpenter <error27@gmail.com>
>> Link: https://github.com/ClangBuiltLinux/linux/issues/1703
>> Cc: llvm@lists.linux.dev
>> Signed-off-by: Nathan Huckleberry <nhuck@google.com>
>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>

Thanks for the patch and reviews, pushed to drm-intel-next.

BR,
Jani.

>
>> ---
>>  drivers/gpu/drm/i915/display/intel_dvo_dev.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_dvo_dev.h b/drivers/gpu/drm/i915/display/intel_dvo_dev.h
>> index d96c3cc46e50..50205f064d93 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dvo_dev.h
>> +++ b/drivers/gpu/drm/i915/display/intel_dvo_dev.h
>> @@ -75,8 +75,8 @@ struct intel_dvo_dev_ops {
>>  	 *
>>  	 * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
>>  	 */
>> -	int (*mode_valid)(struct intel_dvo_device *dvo,
>> -			  struct drm_display_mode *mode);
>> +	enum drm_mode_status (*mode_valid)(struct intel_dvo_device *dvo,
>> +					   struct drm_display_mode *mode);
>>  
>>  	/*
>>  	 * Callback for preparing mode changes on an output
>> -- 
>> 2.37.2.789.g6183377224-goog
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-15  7:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 20:55 [PATCH] drm/i915: Fix return type of mode_valid function hook Nathan Huckleberry
2022-09-13 23:19 ` Nathan Chancellor
2022-09-15  7:39   ` Jani Nikula
2022-09-14 13:47 ` [Intel-gfx] " Andrzej Hajda

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).