All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: linuxppc-dev@lists.ozlabs.org
Subject: [Bug 204371] BUG kmalloc-4k (Tainted: G        W        ): Object padding overwritten
Date: Fri, 16 Aug 2019 14:35:55 +0000	[thread overview]
Message-ID: <bug-204371-206035-DZemL6yJn5@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-204371-206035@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=204371

--- Comment #33 from Erhard F. (erhard_f@mailbox.org) ---
On Fri, 16 Aug 2019 08:22:31 +0000
bugzilla-daemon@bugzilla.kernel.org wrote:

> https://bugzilla.kernel.org/show_bug.cgi?id=204371
> 
> --- Comment #32 from Christophe Leroy (christophe.leroy@c-s.fr) ---
> I think first thing is to fix test_add_free_space_entry() :
> - replace the map = kzalloc(...) by map = (void *)get_zeroed_page(...) like
> in
> other places.
> - replace the kfree(map); by free_page((unsigned long)map);
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 062be9dde4c6..ed15645b4321 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -764,7 +764,7 @@ static int __load_free_space_cache(struct btrfs_root *root,
struct inode *inode,
                } else {
                        ASSERT(num_bitmaps);
                        num_bitmaps--;
-                       e->bitmap = kzalloc(PAGE_SIZE, GFP_NOFS);
+                       e->bitmap = (void *)get_zeroed_page(GFP_NOFS);
                        if (!e->bitmap) {
                                kmem_cache_free(
                                        btrfs_free_space_cachep, e);
@@ -1881,7 +1881,7 @@ static void free_bitmap(struct btrfs_free_space_ctl *ctl,
                        struct btrfs_free_space *bitmap_info)
 {
        unlink_free_space(ctl, bitmap_info);
-       kfree(bitmap_info->bitmap);
+       free_page((unsigned long)bitmap_info->bitmap);
        kmem_cache_free(btrfs_free_space_cachep, bitmap_info);
        ctl->total_bitmaps--;
        ctl->op->recalc_thresholds(ctl);
@@ -2135,7 +2135,7 @@ static int insert_into_bitmap(struct btrfs_free_space_ctl
*ctl,
                }

                /* allocate the bitmap */
-               info->bitmap = kzalloc(PAGE_SIZE, GFP_NOFS);
+               info->bitmap = (void *)get_zeroed_page(GFP_NOFS);
                spin_lock(&ctl->tree_lock);
                if (!info->bitmap) {
                        ret = -ENOMEM;
@@ -2146,7 +2146,7 @@ static int insert_into_bitmap(struct btrfs_free_space_ctl
*ctl,

 out:
        if (info) {
-               kfree(info->bitmap);
+               free_page((unsigned long)info->bitmap);
                kmem_cache_free(btrfs_free_space_cachep, info);
        }

@@ -2802,7 +2802,7 @@ u64 btrfs_alloc_from_cluster(struct
btrfs_block_group_cache *block_group,
        if (entry->bytes == 0) {
                ctl->free_extents--;
                if (entry->bitmap) {
-                       kfree(entry->bitmap);
+                       free_page((unsigned long)entry->bitmap);
                        ctl->total_bitmaps--;
                        ctl->op->recalc_thresholds(ctl);
                }
@@ -3606,7 +3606,7 @@ int test_add_free_space_entry(struct
btrfs_block_group_cache *cache,
        }

        if (!map) {
-               map = kzalloc(PAGE_SIZE, GFP_NOFS);
+               map = (void *)get_zeroed_page(GFP_NOFS);
                if (!map) {
                        kmem_cache_free(btrfs_free_space_cachep, info);
                        return -ENOMEM;
@@ -3635,7 +3635,7 @@ int test_add_free_space_entry(struct
btrfs_block_group_cache *cache,

        if (info)
                kmem_cache_free(btrfs_free_space_cachep, info);
-       kfree(map);
+       free_page((unsigned long)map);
        return 0;
 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2019-08-16 14:39 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-204371-206035@https.bugzilla.kernel.org/>
2019-07-29 23:28 ` [Bug 204371] BUG kmalloc-4k (Tainted: G W ): Object padding overwritten bugzilla-daemon
2019-07-30 18:52 ` bugzilla-daemon
2019-07-31 12:00   ` Michael Ellerman
2019-08-17  8:09   ` christophe leroy
2019-07-31  9:03 ` bugzilla-daemon
2019-07-31 12:09 ` bugzilla-daemon
2019-08-01 12:47 ` bugzilla-daemon
2019-08-06 20:47 ` bugzilla-daemon
2019-08-06 20:48 ` bugzilla-daemon
2019-08-06 20:51 ` bugzilla-daemon
2019-08-08 10:53 ` bugzilla-daemon
2019-08-08 11:26 ` bugzilla-daemon
2019-08-09 12:31   ` Michael Ellerman
2019-08-09 12:31     ` Michael Ellerman
2019-08-09 12:31 ` bugzilla-daemon
2019-08-11 20:03 ` bugzilla-daemon
2019-08-11 21:18 ` bugzilla-daemon
2019-08-13  9:19 ` bugzilla-daemon
2019-08-13  9:20 ` bugzilla-daemon
2019-08-13 15:38 ` bugzilla-daemon
2019-08-14  8:56 ` bugzilla-daemon
2019-08-14 15:12 ` bugzilla-daemon
2019-08-14 16:10 ` bugzilla-daemon
2019-08-14 17:44 ` bugzilla-daemon
2019-08-14 17:45 ` bugzilla-daemon
2019-08-14 17:48 ` bugzilla-daemon
2019-08-14 17:53 ` bugzilla-daemon
2019-08-14 20:28 ` bugzilla-daemon
2019-08-14 20:33 ` bugzilla-daemon
2019-08-15 14:38 ` bugzilla-daemon
2019-08-15 16:45 ` bugzilla-daemon
2019-08-15 17:07 ` bugzilla-daemon
2019-08-15 17:11 ` bugzilla-daemon
2019-08-15 17:56 ` bugzilla-daemon
2019-08-15 18:33 ` bugzilla-daemon
2019-08-16  8:22 ` bugzilla-daemon
2019-08-16 14:35 ` bugzilla-daemon [this message]
2019-08-16 14:38 ` bugzilla-daemon
2019-08-16 15:20 ` bugzilla-daemon
2019-08-16 18:02 ` bugzilla-daemon
2019-08-16 20:51 ` bugzilla-daemon
2019-08-17  8:09 ` bugzilla-daemon
2019-08-22 13:39 ` bugzilla-daemon
     [not found] <bug-204371-206129@https.bugzilla.kernel.org/>
     [not found] ` <bug-204371-206129-GvRQpDzlfW@https.bugzilla.kernel.org/>
2019-08-16 14:59   ` Christophe Leroy

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=bug-204371-206035-DZemL6yJn5@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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.