* [bug report] dma-buf: Clarify that dma-buf sg lists are page aligned
@ 2020-11-02 8:15 Dan Carpenter
2020-11-02 21:33 ` Xiong, Jianxin
0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2020-11-02 8:15 UTC (permalink / raw)
To: jianxin.xiong; +Cc: dri-devel
Hello Jianxin Xiong,
The patch ac80cd17a615: "dma-buf: Clarify that dma-buf sg lists are
page aligned" from Oct 14, 2020, leads to the following static
checker warning:
drivers/dma-buf/dma-buf.c:917 dma_buf_map_attachment()
error: 'sg_table' dereferencing possible ERR_PTR()
drivers/dma-buf/dma-buf.c
897 sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
898 if (!sg_table)
899 sg_table = ERR_PTR(-ENOMEM);
900
901 if (IS_ERR(sg_table) && dma_buf_is_dynamic(attach->dmabuf) &&
902 !IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY))
903 dma_buf_unpin(attach);
904
905 if (!IS_ERR(sg_table) && attach->dmabuf->ops->cache_sgt_mapping) {
^^^^^^^^^^^^^^^^^
906 attach->sgt = sg_table;
907 attach->dir = direction;
908 }
909
910 #ifdef CONFIG_DMA_API_DEBUG
911 {
912 struct scatterlist *sg;
913 u64 addr;
914 int len;
915 int i;
916
917 for_each_sgtable_dma_sg(sg_table, sg, i) {
^^^^^^^^^
Not checked here.
918 addr = sg_dma_address(sg);
919 len = sg_dma_len(sg);
920 if (!PAGE_ALIGNED(addr) || !PAGE_ALIGNED(len)) {
921 pr_debug("%s: addr %llx or len %x is not page aligned!\n",
922 __func__, addr, len);
923 }
924 }
925 }
926 #endif /* CONFIG_DMA_API_DEBUG */
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [bug report] dma-buf: Clarify that dma-buf sg lists are page aligned
2020-11-02 8:15 [bug report] dma-buf: Clarify that dma-buf sg lists are page aligned Dan Carpenter
@ 2020-11-02 21:33 ` Xiong, Jianxin
2020-11-02 21:59 ` Daniel Vetter
2020-11-03 6:23 ` Dan Carpenter
0 siblings, 2 replies; 4+ messages in thread
From: Xiong, Jianxin @ 2020-11-02 21:33 UTC (permalink / raw)
To: Dan Carpenter; +Cc: dri-devel
Hi Dan,
Thanks for reporting the bug. I see what was missing. Am I supposed to submit a patch to
replace the original patch or just to fix this bug?
Jianxin
> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Sent: Monday, November 02, 2020 12:15 AM
> To: Xiong, Jianxin <jianxin.xiong@intel.com>
> Cc: dri-devel@lists.freedesktop.org
> Subject: [bug report] dma-buf: Clarify that dma-buf sg lists are page aligned
>
> Hello Jianxin Xiong,
>
> The patch ac80cd17a615: "dma-buf: Clarify that dma-buf sg lists are page aligned" from Oct 14, 2020, leads to the following static checker
> warning:
>
> drivers/dma-buf/dma-buf.c:917 dma_buf_map_attachment()
> error: 'sg_table' dereferencing possible ERR_PTR()
>
> drivers/dma-buf/dma-buf.c
> 897 sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
> 898 if (!sg_table)
> 899 sg_table = ERR_PTR(-ENOMEM);
> 900
> 901 if (IS_ERR(sg_table) && dma_buf_is_dynamic(attach->dmabuf) &&
> 902 !IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY))
> 903 dma_buf_unpin(attach);
> 904
> 905 if (!IS_ERR(sg_table) && attach->dmabuf->ops->cache_sgt_mapping) {
> ^^^^^^^^^^^^^^^^^
>
> 906 attach->sgt = sg_table;
> 907 attach->dir = direction;
> 908 }
> 909
> 910 #ifdef CONFIG_DMA_API_DEBUG
> 911 {
> 912 struct scatterlist *sg;
> 913 u64 addr;
> 914 int len;
> 915 int i;
> 916
> 917 for_each_sgtable_dma_sg(sg_table, sg, i) {
> ^^^^^^^^^ Not checked here.
>
> 918 addr = sg_dma_address(sg);
> 919 len = sg_dma_len(sg);
> 920 if (!PAGE_ALIGNED(addr) || !PAGE_ALIGNED(len)) {
> 921 pr_debug("%s: addr %llx or len %x is not page aligned!\n",
> 922 __func__, addr, len);
> 923 }
> 924 }
> 925 }
> 926 #endif /* CONFIG_DMA_API_DEBUG */
>
> regards,
> dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [bug report] dma-buf: Clarify that dma-buf sg lists are page aligned
2020-11-02 21:33 ` Xiong, Jianxin
@ 2020-11-02 21:59 ` Daniel Vetter
2020-11-03 6:23 ` Dan Carpenter
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2020-11-02 21:59 UTC (permalink / raw)
To: Xiong, Jianxin; +Cc: dri-devel, Dan Carpenter
On Mon, Nov 2, 2020 at 10:33 PM Xiong, Jianxin <jianxin.xiong@intel.com> wrote:
>
> Hi Dan,
>
> Thanks for reporting the bug. I see what was missing. Am I supposed to submit a patch to
> replace the original patch or just to fix this bug?
drm-misc-next doesn't rebase (except in emergencies), so please follow
up with a fixup patch that references the one already merged with
Fixes: line and everything else.
Thanks, Daniel
>
> Jianxin
>
> > -----Original Message-----
> > From: Dan Carpenter <dan.carpenter@oracle.com>
> > Sent: Monday, November 02, 2020 12:15 AM
> > To: Xiong, Jianxin <jianxin.xiong@intel.com>
> > Cc: dri-devel@lists.freedesktop.org
> > Subject: [bug report] dma-buf: Clarify that dma-buf sg lists are page aligned
> >
> > Hello Jianxin Xiong,
> >
> > The patch ac80cd17a615: "dma-buf: Clarify that dma-buf sg lists are page aligned" from Oct 14, 2020, leads to the following static checker
> > warning:
> >
> > drivers/dma-buf/dma-buf.c:917 dma_buf_map_attachment()
> > error: 'sg_table' dereferencing possible ERR_PTR()
> >
> > drivers/dma-buf/dma-buf.c
> > 897 sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
> > 898 if (!sg_table)
> > 899 sg_table = ERR_PTR(-ENOMEM);
> > 900
> > 901 if (IS_ERR(sg_table) && dma_buf_is_dynamic(attach->dmabuf) &&
> > 902 !IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY))
> > 903 dma_buf_unpin(attach);
> > 904
> > 905 if (!IS_ERR(sg_table) && attach->dmabuf->ops->cache_sgt_mapping) {
> > ^^^^^^^^^^^^^^^^^
> >
> > 906 attach->sgt = sg_table;
> > 907 attach->dir = direction;
> > 908 }
> > 909
> > 910 #ifdef CONFIG_DMA_API_DEBUG
> > 911 {
> > 912 struct scatterlist *sg;
> > 913 u64 addr;
> > 914 int len;
> > 915 int i;
> > 916
> > 917 for_each_sgtable_dma_sg(sg_table, sg, i) {
> > ^^^^^^^^^ Not checked here.
> >
> > 918 addr = sg_dma_address(sg);
> > 919 len = sg_dma_len(sg);
> > 920 if (!PAGE_ALIGNED(addr) || !PAGE_ALIGNED(len)) {
> > 921 pr_debug("%s: addr %llx or len %x is not page aligned!\n",
> > 922 __func__, addr, len);
> > 923 }
> > 924 }
> > 925 }
> > 926 #endif /* CONFIG_DMA_API_DEBUG */
> >
> > regards,
> > dan carpenter
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [bug report] dma-buf: Clarify that dma-buf sg lists are page aligned
2020-11-02 21:33 ` Xiong, Jianxin
2020-11-02 21:59 ` Daniel Vetter
@ 2020-11-03 6:23 ` Dan Carpenter
1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-11-03 6:23 UTC (permalink / raw)
To: Xiong, Jianxin; +Cc: dri-devel
On Mon, Nov 02, 2020 at 09:33:08PM +0000, Xiong, Jianxin wrote:
> Hi Dan,
>
> Thanks for reporting the bug. I see what was missing. Am I supposed to submit a patch to
> replace the original patch or just to fix this bug?
>
Once the patch has been applied, then it's too late to replace it. Just
send a patch to fix it.
regards,
dan carpenter
> Jianxin
>
> > -----Original Message-----
> > From: Dan Carpenter <dan.carpenter@oracle.com>
> > Sent: Monday, November 02, 2020 12:15 AM
> > To: Xiong, Jianxin <jianxin.xiong@intel.com>
> > Cc: dri-devel@lists.freedesktop.org
> > Subject: [bug report] dma-buf: Clarify that dma-buf sg lists are page aligned
> >
> > Hello Jianxin Xiong,
> >
> > The patch ac80cd17a615: "dma-buf: Clarify that dma-buf sg lists are page aligned" from Oct 14, 2020, leads to the following static checker
> > warning:
> >
> > drivers/dma-buf/dma-buf.c:917 dma_buf_map_attachment()
> > error: 'sg_table' dereferencing possible ERR_PTR()
> >
> > drivers/dma-buf/dma-buf.c
> > 897 sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
> > 898 if (!sg_table)
> > 899 sg_table = ERR_PTR(-ENOMEM);
> > 900
> > 901 if (IS_ERR(sg_table) && dma_buf_is_dynamic(attach->dmabuf) &&
> > 902 !IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY))
> > 903 dma_buf_unpin(attach);
> > 904
> > 905 if (!IS_ERR(sg_table) && attach->dmabuf->ops->cache_sgt_mapping) {
> > ^^^^^^^^^^^^^^^^^
> >
> > 906 attach->sgt = sg_table;
> > 907 attach->dir = direction;
> > 908 }
> > 909
> > 910 #ifdef CONFIG_DMA_API_DEBUG
> > 911 {
> > 912 struct scatterlist *sg;
> > 913 u64 addr;
> > 914 int len;
> > 915 int i;
> > 916
> > 917 for_each_sgtable_dma_sg(sg_table, sg, i) {
> > ^^^^^^^^^ Not checked here.
> >
> > 918 addr = sg_dma_address(sg);
> > 919 len = sg_dma_len(sg);
> > 920 if (!PAGE_ALIGNED(addr) || !PAGE_ALIGNED(len)) {
> > 921 pr_debug("%s: addr %llx or len %x is not page aligned!\n",
> > 922 __func__, addr, len);
> > 923 }
> > 924 }
> > 925 }
> > 926 #endif /* CONFIG_DMA_API_DEBUG */
> >
> > regards,
> > dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-03 6:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02 8:15 [bug report] dma-buf: Clarify that dma-buf sg lists are page aligned Dan Carpenter
2020-11-02 21:33 ` Xiong, Jianxin
2020-11-02 21:59 ` Daniel Vetter
2020-11-03 6:23 ` Dan Carpenter
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).