linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.10] drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap()
@ 2023-09-22 15:51 Nathan Chancellor
  2023-09-29 16:11 ` Nick Desaulniers
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nathan Chancellor @ 2023-09-22 15:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sasha Levin
  Cc: Chun-Kuang Hu, Philipp Zabel, linux-mediatek, stable, llvm,
	Nathan Chancellor

When building with clang:

  drivers/gpu/drm/mediatek/mtk_drm_gem.c:255:10: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'void *' [-Wint-conversion]
    255 |                 return -ENOMEM;
        |                        ^~~~~~~
  1 error generated.

GCC reports the same issue as a warning, rather than an error.

Prior to commit 7e542ff8b463 ("drm/mediatek: Use struct dma_buf_map in
GEM vmap ops"), this function returned a pointer rather than an integer.
This function is indirectly called in drm_gem_vmap(), which treats NULL
as -ENOMEM through an error pointer. Return NULL in this block to
resolve the warning but keep the same end result.

Fixes: 43f561e809aa ("drm/mediatek: Fix potential memory leak if vmap() fail")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
This is a fix for a 5.10 backport, so it has no upstream relevance but
I've still cc'd the relevant maintainers in case they have any comments
or want to double check my work.
---
 drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
index fe64bf2176f3..b20ea58907c2 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
@@ -252,7 +252,7 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
 	if (!mtk_gem->kvaddr) {
 		kfree(sgt);
 		kfree(mtk_gem->pages);
-		return -ENOMEM;
+		return NULL;
 	}
 out:
 	kfree(sgt);

---
base-commit: ff0bfa8f23eb4c5a65ee6b0d0b7dc2e3439f1063
change-id: 20230922-5-10-fix-drm-mediatek-backport-0ee69329fef0

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>



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

* Re: [PATCH 5.10] drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap()
  2023-09-22 15:51 [PATCH 5.10] drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap() Nathan Chancellor
@ 2023-09-29 16:11 ` Nick Desaulniers
  2023-10-07  9:55 ` Patch "drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap()" has been added to the 5.10-stable tree gregkh
  2023-10-07  9:56 ` [PATCH 5.10] drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap() Greg Kroah-Hartman
  2 siblings, 0 replies; 4+ messages in thread
From: Nick Desaulniers @ 2023-09-29 16:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sasha Levin
  Cc: Chun-Kuang Hu, Philipp Zabel, linux-mediatek, stable, llvm,
	Nathan Chancellor

On Fri, Sep 22, 2023 at 8:51 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When building with clang:
>
>   drivers/gpu/drm/mediatek/mtk_drm_gem.c:255:10: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'void *' [-Wint-conversion]
>     255 |                 return -ENOMEM;
>         |                        ^~~~~~~
>   1 error generated.
>
> GCC reports the same issue as a warning, rather than an error.
>
> Prior to commit 7e542ff8b463 ("drm/mediatek: Use struct dma_buf_map in
> GEM vmap ops"), this function returned a pointer rather than an integer.
> This function is indirectly called in drm_gem_vmap(), which treats NULL
> as -ENOMEM through an error pointer. Return NULL in this block to
> resolve the warning but keep the same end result.
>
> Fixes: 43f561e809aa ("drm/mediatek: Fix potential memory leak if vmap() fail")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

(resending as text/plain)
Did this get picked up? Our CI has been red for a few days on
linux-5.10.y over this.

> ---
> This is a fix for a 5.10 backport, so it has no upstream relevance but
> I've still cc'd the relevant maintainers in case they have any comments
> or want to double check my work.
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> index fe64bf2176f3..b20ea58907c2 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> @@ -252,7 +252,7 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
>         if (!mtk_gem->kvaddr) {
>                 kfree(sgt);
>                 kfree(mtk_gem->pages);
> -               return -ENOMEM;
> +               return NULL;
>         }
>  out:
>         kfree(sgt);
>
> ---
> base-commit: ff0bfa8f23eb4c5a65ee6b0d0b7dc2e3439f1063
> change-id: 20230922-5-10-fix-drm-mediatek-backport-0ee69329fef0
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>
>


-- 
Thanks,
~Nick Desaulniers


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

* Patch "drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap()" has been added to the 5.10-stable tree
  2023-09-22 15:51 [PATCH 5.10] drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap() Nathan Chancellor
  2023-09-29 16:11 ` Nick Desaulniers
@ 2023-10-07  9:55 ` gregkh
  2023-10-07  9:56 ` [PATCH 5.10] drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap() Greg Kroah-Hartman
  2 siblings, 0 replies; 4+ messages in thread
From: gregkh @ 2023-10-07  9:55 UTC (permalink / raw)
  To: chunkuang.hu, gregkh, linux-mediatek, llvm, nathan, p.zabel, sashal
  Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap()

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-mediatek-fix-backport-issue-in-mtk_drm_gem_prime_vmap.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From nathan@kernel.org  Sat Oct  7 11:52:29 2023
From: Nathan Chancellor <nathan@kernel.org>
Date: Fri, 22 Sep 2023 08:51:17 -0700
Subject: drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap()
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sasha Levin <sashal@kernel.org>
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>, Philipp Zabel <p.zabel@pengutronix.de>, linux-mediatek@lists.infradead.org, stable@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>
Message-ID: <20230922-5-10-fix-drm-mediatek-backport-v1-1-912d76cd4a96@kernel.org>

From: Nathan Chancellor <nathan@kernel.org>

When building with clang:

  drivers/gpu/drm/mediatek/mtk_drm_gem.c:255:10: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'void *' [-Wint-conversion]
    255 |                 return -ENOMEM;
        |                        ^~~~~~~
  1 error generated.

GCC reports the same issue as a warning, rather than an error.

Prior to commit 7e542ff8b463 ("drm/mediatek: Use struct dma_buf_map in
GEM vmap ops"), this function returned a pointer rather than an integer.
This function is indirectly called in drm_gem_vmap(), which treats NULL
as -ENOMEM through an error pointer. Return NULL in this block to
resolve the warning but keep the same end result.

Fixes: 43f561e809aa ("drm/mediatek: Fix potential memory leak if vmap() fail")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/mediatek/mtk_drm_gem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
@@ -252,7 +252,7 @@ void *mtk_drm_gem_prime_vmap(struct drm_
 	if (!mtk_gem->kvaddr) {
 		kfree(sgt);
 		kfree(mtk_gem->pages);
-		return -ENOMEM;
+		return NULL;
 	}
 out:
 	kfree(sgt);


Patches currently in stable-queue which might be from nathan@kernel.org are

queue-5.10/drm-mediatek-fix-backport-issue-in-mtk_drm_gem_prime_vmap.patch
queue-5.10/bpf-fix-btf_id-symbol-generation-collision.patch
queue-5.10/bpf-fix-btf_id-symbol-generation-collision-in-tools.patch


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

* Re: [PATCH 5.10] drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap()
  2023-09-22 15:51 [PATCH 5.10] drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap() Nathan Chancellor
  2023-09-29 16:11 ` Nick Desaulniers
  2023-10-07  9:55 ` Patch "drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap()" has been added to the 5.10-stable tree gregkh
@ 2023-10-07  9:56 ` Greg Kroah-Hartman
  2 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2023-10-07  9:56 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Sasha Levin, Chun-Kuang Hu, Philipp Zabel, linux-mediatek, stable, llvm

On Fri, Sep 22, 2023 at 08:51:17AM -0700, Nathan Chancellor wrote:
> When building with clang:
> 
>   drivers/gpu/drm/mediatek/mtk_drm_gem.c:255:10: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'void *' [-Wint-conversion]
>     255 |                 return -ENOMEM;
>         |                        ^~~~~~~
>   1 error generated.
> 
> GCC reports the same issue as a warning, rather than an error.
> 
> Prior to commit 7e542ff8b463 ("drm/mediatek: Use struct dma_buf_map in
> GEM vmap ops"), this function returned a pointer rather than an integer.
> This function is indirectly called in drm_gem_vmap(), which treats NULL
> as -ENOMEM through an error pointer. Return NULL in this block to
> resolve the warning but keep the same end result.
> 
> Fixes: 43f561e809aa ("drm/mediatek: Fix potential memory leak if vmap() fail")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> This is a fix for a 5.10 backport, so it has no upstream relevance but
> I've still cc'd the relevant maintainers in case they have any comments
> or want to double check my work.

Now queued up, thanks.

greg k-h


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

end of thread, other threads:[~2023-10-07  9:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-22 15:51 [PATCH 5.10] drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap() Nathan Chancellor
2023-09-29 16:11 ` Nick Desaulniers
2023-10-07  9:55 ` Patch "drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap()" has been added to the 5.10-stable tree gregkh
2023-10-07  9:56 ` [PATCH 5.10] drm/mediatek: Fix backport issue in mtk_drm_gem_prime_vmap() Greg Kroah-Hartman

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