All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jianxin.xiong@intel.com
Cc: dri-devel@lists.freedesktop.org
Subject: [bug report] dma-buf: Clarify that dma-buf sg lists are page aligned
Date: Mon, 2 Nov 2020 11:15:08 +0300	[thread overview]
Message-ID: <20201102081508.GA104814@mwanda> (raw)

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

             reply	other threads:[~2020-11-02  8:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02  8:15 Dan Carpenter [this message]
2020-11-02 21:33 ` [bug report] dma-buf: Clarify that dma-buf sg lists are page aligned Xiong, Jianxin
2020-11-02 21:59   ` Daniel Vetter
2020-11-03  6:23   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201102081508.GA104814@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jianxin.xiong@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.