From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Chris Mason <chris.mason@fusionio.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-btrfs@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>,
Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com>,
Gleb Natapov <gleb@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Mark Brown <broonie@kernel.org>
Subject: Re: [GIT PULL] Btrfs
Date: Fri, 15 Nov 2013 12:32:16 +0100 [thread overview]
Message-ID: <20131115113216.GA7777@osiris> (raw)
In-Reply-To: <20131114171952.3802.93244@localhost.localdomain>
On Thu, Nov 14, 2013 at 12:19:52PM -0500, Chris Mason wrote:
> Hi Linus,
>
> Please pull my for-linus branch:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git for-linus
>
> This is our usual merge window set of bug fixes, performance
> improvements and cleanups. Miao Xie has some really nice optimizations
> for writeback.
>
> Josef also expanded our sanity checks quite a bit; these make up a big
> chunk of the new lines.
Hmm.. b19e68439375 "btrfs: Remove redundant local zero structure" seems to
use the empty_zero_page incorrectly and causes this compile warning on s390:
CC fs/btrfs/ioctl.o
fs/btrfs/ioctl.c: In function 'btrfs_is_empty_uuid':
fs/btrfs/ioctl.c:372:2: warning: passing argument 2 of 'memcmp' makes pointer from
integer without a cast [enabled by default]
return !memcmp(uuid, empty_zero_page, BTRFS_UUID_SIZE);
^
In fact there seem to be two more incorrect usages in the kernel. The patch
below is not really tested.
>From c2a9d3a453629466f0528aacbc6cbecc4247cff5 Mon Sep 17 00:00:00 2001
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Date: Fri, 15 Nov 2013 12:14:55 +0100
Subject: [PATCH] fix empty_zero_page misusage
The definition of empty_zero_page is architecture specific.
It is (currently) either a character array, an unsigned long containing
the address of the empty_zero_page, or even worse only the address
of the struct page belonging to the empty_zero_page.
So using empty_zero_page as source address to e.g. clear something may
give random results.
ZERO_PAGE() however returns across all architectures the pointer to
the struct page belonging to the empty_zero_page.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
drivers/spi/spi-fsl-cpm.c | 3 ++-
fs/btrfs/ioctl.c | 4 +++-
virt/kvm/kvm_main.c | 5 +++--
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c
index 54b06376f03c..3807bbf8a48f 100644
--- a/drivers/spi/spi-fsl-cpm.c
+++ b/drivers/spi/spi-fsl-cpm.c
@@ -280,6 +280,7 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi)
int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi)
{
+ const void *zero_page = (const void *) page_to_phys(ZERO_PAGE(0));
struct device *dev = mspi->dev;
struct device_node *np = dev->of_node;
const u32 *iprop;
@@ -324,7 +325,7 @@ int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi)
goto err_bds;
}
- mspi->dma_dummy_tx = dma_map_single(dev, empty_zero_page, PAGE_SIZE,
+ mspi->dma_dummy_tx = dma_map_single(dev, zero_page, PAGE_SIZE,
DMA_TO_DEVICE);
if (dma_mapping_error(dev, mspi->dma_dummy_tx)) {
dev_err(dev, "unable to map dummy tx buffer\n");
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 1d04b5559e61..83f2b3e4fbf0 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -368,8 +368,10 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
int btrfs_is_empty_uuid(u8 *uuid)
{
+ const void *zero_page = (const void *) page_to_phys(ZERO_PAGE(0));
+
BUILD_BUG_ON(BTRFS_UUID_SIZE > PAGE_SIZE);
- return !memcmp(uuid, empty_zero_page, BTRFS_UUID_SIZE);
+ return !memcmp(uuid, zero_page, BTRFS_UUID_SIZE);
}
static noinline int create_subvol(struct inode *dir,
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 662f34c3287e..01edf1c19332 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1615,8 +1615,9 @@ EXPORT_SYMBOL_GPL(kvm_read_guest_cached);
int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len)
{
- return kvm_write_guest_page(kvm, gfn, (const void *) empty_zero_page,
- offset, len);
+ const void *zero_page = (const void *) page_to_phys(ZERO_PAGE(0));
+
+ return kvm_write_guest_page(kvm, gfn, zero_page, offset, len);
}
EXPORT_SYMBOL_GPL(kvm_clear_guest_page);
--
1.8.3.4
next prev parent reply other threads:[~2013-11-15 11:33 UTC|newest]
Thread overview: 126+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-14 17:19 [GIT PULL] Btrfs Chris Mason
2013-11-15 11:32 ` Heiko Carstens [this message]
2013-11-15 12:21 ` Chris Mason
2013-11-15 13:40 ` Chris Mason
2013-11-15 13:42 ` Geert Uytterhoeven
2013-11-15 14:57 ` Heiko Carstens
2013-11-17 9:36 ` Gleb Natapov
2013-11-18 9:35 ` Heiko Carstens
2013-11-18 10:30 ` Will Deacon
-- strict thread matches above, loose matches on Subject: below --
2017-06-10 13:00 Chris Mason
2017-05-09 17:56 Chris Mason
2017-05-09 18:01 ` Chris Mason
2017-04-28 0:26 Chris Mason
2017-04-14 18:28 Chris Mason
2017-03-31 21:05 Chris Mason
2017-03-23 15:09 Chris Mason
2017-03-02 20:19 Chris Mason
2017-02-25 0:56 Chris Mason
2017-02-11 13:18 Chris Mason
2017-01-27 19:37 Chris Mason
2016-12-16 17:01 Chris Mason
2016-11-04 17:28 Chris Mason
2016-10-28 14:08 Chris Mason
2016-10-14 20:31 Chris Mason
2016-10-11 15:46 Chris Mason
2016-09-23 20:01 Chris Mason
2016-09-09 17:46 Chris Mason
2016-09-03 13:54 Chris Mason
2016-08-26 23:36 Chris Mason
2016-08-10 12:10 Chris Mason
2016-08-04 19:12 Chris Mason
2016-07-31 13:55 Chris Mason
2016-06-18 13:01 Chris Mason
2016-06-10 20:01 Chris Mason
2016-06-03 20:57 Chris Mason
2016-05-27 17:44 Chris Mason
2016-05-21 14:18 Chris Mason
2016-04-08 20:43 Chris Mason
2016-04-01 22:45 Chris Mason
2016-03-22 0:24 Chris Mason
2016-03-22 1:16 ` Linus Torvalds
2016-03-22 2:15 ` Chris Mason
2016-03-22 2:24 ` Chris Mason
2016-03-22 2:38 ` Linus Torvalds
2016-03-04 18:51 Chris Mason
2016-02-19 19:08 Chris Mason
2016-02-12 16:43 Chris Mason
2016-01-29 18:42 Chris Mason
2016-01-22 16:34 Chris Mason
2016-01-17 23:30 Chris Mason
2016-01-18 10:25 ` Martin Steigerwald
2016-01-18 10:52 ` Holger Hoffstätte
2015-12-18 17:28 Chris Mason
2015-11-27 21:13 Chris Mason
2015-11-13 20:37 Chris Mason
2015-11-06 18:44 Chris Mason
2015-10-23 12:47 Chris Mason
2015-10-16 17:34 Chris Mason
2015-10-09 17:42 Chris Mason
2015-09-25 17:35 Chris Mason
2015-09-11 18:44 Chris Mason
2015-08-08 19:41 Chris Mason
2015-07-31 18:21 Chris Mason
2015-07-17 19:38 Chris Mason
2015-07-10 19:15 Chris Mason
2015-06-29 21:11 Chris Mason
2015-05-23 1:14 Chris Mason
2015-05-26 12:33 ` Josh Boyer
2015-05-26 12:54 ` Chris Mason
2015-06-02 14:02 ` Josh Boyer
2015-06-26 14:21 ` David Sterba
2015-03-06 21:45 Chris Mason
2015-02-26 2:01 Chris Mason
2015-02-19 20:36 Chris Mason
2015-02-20 10:09 ` Markus Trippelsdorf
2014-11-09 1:17 Chris Mason
2014-10-11 0:41 Chris Mason
2014-08-14 17:59 Chris Mason
2014-08-14 18:10 ` Linus Torvalds
2014-08-14 18:17 ` Chris Mason
2014-07-20 14:33 Chris Mason
2014-07-04 14:42 Chris Mason
2014-06-20 15:53 Chris Mason
2014-05-20 19:25 Chris Mason
2014-04-26 23:31 Chris Mason
2014-02-16 13:13 Chris Mason
2014-02-09 19:13 Chris Mason
2014-02-04 17:59 Chris Mason
2014-01-30 21:52 Chris Mason
2014-02-02 0:15 ` David Rientjes
2014-02-02 1:28 ` Filipe David Manana
2014-02-02 2:40 ` David Rientjes
2014-02-02 8:09 ` Chris Samuel
2014-02-03 17:54 ` David Sterba
2014-02-03 18:18 ` Chris Mason
2014-02-04 19:50 ` Greg KH
2014-02-04 19:52 ` Chris Mason
2013-12-12 21:57 Chris Mason
2013-11-21 18:35 Chris Mason
2013-11-15 15:19 Chris Mason
2013-11-15 16:11 ` Geert Uytterhoeven
2013-10-18 23:24 Chris Mason
2013-10-12 1:01 Chris Mason
2013-10-05 17:36 Chris Mason
2013-09-22 20:50 Chris Mason
2013-09-12 15:36 Chris Mason
2013-09-12 20:38 ` Josh Boyer
2013-09-13 6:44 ` Geert Uytterhoeven
2013-09-13 11:53 ` Josh Boyer
2013-09-13 12:15 ` Russell King
2013-09-13 12:36 ` Geert Uytterhoeven
2013-09-13 15:06 ` Josh Boyer
2013-09-13 15:38 ` Josh Boyer
2013-09-13 15:58 ` Russell King
2013-09-14 9:33 ` Heiko Carstens
2013-09-13 13:07 ` Ric Wheeler
2013-09-13 14:11 ` Hugo Mills
2013-08-10 12:28 Chris Mason
2013-07-09 19:18 Chris Mason
2013-06-14 1:29 Chris Mason
2013-05-09 19:26 Chris Mason
2013-03-02 15:15 Chris Mason
2013-03-02 15:41 ` Liu Bo
2013-03-03 0:45 ` Linus Torvalds
2013-03-03 1:10 ` Chris Mason
2012-10-09 21:05 Chris Mason
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=20131115113216.GA7777@osiris \
--to=heiko.carstens@de.ibm.com \
--cc=broonie@kernel.org \
--cc=chris.mason@fusionio.com \
--cc=dulshani.gunawardhana89@gmail.com \
--cc=gleb@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=torvalds@linux-foundation.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 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).