Skip to content

Commit 46e0f66

Browse files
author
Chris Mason
committed
btrfs: fix empty_zero_page misusage
Heiko Carstens noticed that btrfs was using empty_zero_page incorrectly. He explained: 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. This commit changes btrfs to use a for-loop instead. On x86 the resulting .ko is smaller, and we're no longer worrying about how each arch builds its zeros. Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
1 parent 91aef86 commit 46e0f66

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎fs/btrfs/ioctl.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,13 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
368368

369369
int btrfs_is_empty_uuid(u8 *uuid)
370370
{
371-
BUILD_BUG_ON(BTRFS_UUID_SIZE > PAGE_SIZE);
372-
return !memcmp(uuid, empty_zero_page, BTRFS_UUID_SIZE);
371+
int i;
372+
373+
for (i = 0; i < BTRFS_UUID_SIZE; i++) {
374+
if (uuid[i])
375+
return 0;
376+
}
377+
return 1;
373378
}
374379

375380
static noinline int create_subvol(struct inode *dir,

0 commit comments

Comments
 (0)