Patch series "DAMON fixes". This patch (of 2): DAMON users can trigger below warning in '__alloc_pages()' by invoking write() to some DAMON debugfs files with arbitrarily high count argument, because DAMON debugfs interface allocates some buffers based on the user-specified 'count'. if (unlikely(order >= MAX_ORDER)) { WARN_ON_ONCE(!(gfp & __GFP_NOWARN)); return NULL; } Because the DAMON debugfs interface code checks failure of the 'kmalloc()', this commit simply suppresses the warnings by adding '__GFP_NOWARN' flag.
Unified · Split
| @@ -32,7 +32,7 @@ static char *user_input_str(const char __user *buf, size_t count, loff_t *ppos) · 31 unmodified lines | |||
| 32 | if (*ppos) | 32 | if (*ppos) |
| 33 | return ERR_PTR(-EINVAL); | 33 | return ERR_PTR(-EINVAL); |
| 34 | 34 | ||
| 35 | kbuf = kmalloc(count + 1, GFP_KERNEL); | 35 | kbuf = kmalloc(count + 1, GFP_KERNEL | __GFP_NOWARN); |
| 36 | if (!kbuf) | 36 | if (!kbuf) |
| 37 | return ERR_PTR(-ENOMEM); | 37 | return ERR_PTR(-ENOMEM); |
| 38 | 38 | ||
| @@ -133,7 +133,7 @@ static ssize_t dbgfs_schemes_read(struct file *file, char __user *buf, · 94 unmodified lines | |||
| 133 | char *kbuf; | 133 | char *kbuf; |
| 134 | ssize_t len; | 134 | ssize_t len; |
| 135 | 135 | ||
| 136 | kbuf = kmalloc(count, GFP_KERNEL); | 136 | kbuf = kmalloc(count, GFP_KERNEL | __GFP_NOWARN); |
| 137 | if (!kbuf) | 137 | if (!kbuf) |
| 138 | return -ENOMEM; | 138 | return -ENOMEM; |
| 139 | 139 | ||
| @@ -452,7 +452,7 @@ static ssize_t dbgfs_init_regions_read(struct file *file, char __user *buf, · 312 unmodified lines | |||
| 452 | char *kbuf; | 452 | char *kbuf; |
| 453 | ssize_t len; | 453 | ssize_t len; |
| 454 | 454 | ||
| 455 | kbuf = kmalloc(count, GFP_KERNEL); | 455 | kbuf = kmalloc(count, GFP_KERNEL | __GFP_NOWARN); |
| 456 | if (!kbuf) | 456 | if (!kbuf) |
| 457 | return -ENOMEM; | 457 | return -ENOMEM; |
| 458 | 458 | ||
| @@ -578,7 +578,7 @@ static ssize_t dbgfs_kdamond_pid_read(struct file *file, · 119 unmodified lines | |||
| 578 | char *kbuf; | 578 | char *kbuf; |
| 579 | ssize_t len; | 579 | ssize_t len; |
| 580 | 580 | ||
| 581 | kbuf = kmalloc(count, GFP_KERNEL); | 581 | kbuf = kmalloc(count, GFP_KERNEL | __GFP_NOWARN); |
| 582 | if (!kbuf) | 582 | if (!kbuf) |
| 583 | return -ENOMEM; | 583 | return -ENOMEM; |
| 584 | 584 | ||