From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scatterlist: add a warning if sg_virt() is used on highmem pages
Date: Thu, 06 Dec 2012 09:47:52 +0100 [thread overview]
Message-ID: <50C05BB8.6090908@linutronix.de> (raw)
In-Reply-To: <20121205134604.17523790.akpm@linux-foundation.org>
On 12/05/2012 10:46 PM, Andrew Morton wrote:
>> --- 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.
I missed that it will work for previously mapped page. If you think
that an oops later is enough then okay, I drop this.
Sebastian
prev parent reply other threads:[~2012-12-06 8:47 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
2012-12-06 8:47 ` Sebastian Andrzej Siewior [this message]
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=50C05BB8.6090908@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=akpm@linux-foundation.org \
--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.