From: Andrew Morton <akpm@linux-foundation.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scatterlist: add a warning if sg_virt() is used on highmem pages
Date: Wed, 5 Dec 2012 13:46:04 -0800 [thread overview]
Message-ID: <20121205134604.17523790.akpm@linux-foundation.org> (raw)
In-Reply-To: <1354706898-24515-1-git-send-email-bigeasy@linutronix.de>
On Wed, 5 Dec 2012 12:28:18 +0100
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> sg_virt() on highmem pages won't work. This WARN_ON() should catch some
> that still try.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> include/linux/scatterlist.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
> index 4bd6c06..4d4adab 100644
> --- a/include/linux/scatterlist.h
> +++ b/include/linux/scatterlist.h
> @@ -198,6 +198,9 @@ static inline dma_addr_t sg_phys(struct scatterlist *sg)
> **/
> static inline void *sg_virt(struct scatterlist *sg)
> {
> +#ifdef CONFIG_DEBUG_SG
> + WARN_ON(PageHighMem(sg_page(sg)));
> +#endif
> return page_address(sg_page(sg)) + sg->offset;
> }
Why won't it work? page_address() will search the kmap table and will
search for the page. If the caller had previously kmapped that page,
all is well. If the caller has failed to kmap the page, sg_virt() will
return a nearly-null pointer and presumably someone will later go oops.
next prev parent reply other threads:[~2012-12-05 21:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-05 11:28 [PATCH] scatterlist: add a warning if sg_virt() is used on highmem pages Sebastian Andrzej Siewior
2012-12-05 21:46 ` Andrew Morton [this message]
2012-12-06 8:47 ` Sebastian Andrzej Siewior
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=20121205134604.17523790.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
/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.