Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ubifs: vmalloc(array_size()) -> vmalloc_array()

Remove array_size() calls and replace vmalloc() with vmalloc_array() in
ubifs_create_dflt_lpt()/lpt_init_rd()/lpt_init_wr(). vmalloc_array() is
optimized better, resulting in less instructions being used [1].

[1]: https://lore.kernel.org/lkml/abc66ec5-85a4-47e1-9759-2f60ab111971@vivo.com/

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>

authored by

Qianfeng Rong and committed by
Richard Weinberger
0695aef2 d133e30a

+6 -6
+6 -6
fs/ubifs/lpt.c
··· 628 628 pnode = kzalloc(sizeof(struct ubifs_pnode), GFP_KERNEL); 629 629 nnode = kzalloc(sizeof(struct ubifs_nnode), GFP_KERNEL); 630 630 buf = vmalloc(c->leb_size); 631 - ltab = vmalloc(array_size(sizeof(struct ubifs_lpt_lprops), 632 - c->lpt_lebs)); 631 + ltab = vmalloc_array(c->lpt_lebs, 632 + sizeof(struct ubifs_lpt_lprops)); 633 633 if (!pnode || !nnode || !buf || !ltab || !lsave) { 634 634 err = -ENOMEM; 635 635 goto out; ··· 1777 1777 { 1778 1778 int err, i; 1779 1779 1780 - c->ltab = vmalloc(array_size(sizeof(struct ubifs_lpt_lprops), 1781 - c->lpt_lebs)); 1780 + c->ltab = vmalloc_array(c->lpt_lebs, 1781 + sizeof(struct ubifs_lpt_lprops)); 1782 1782 if (!c->ltab) 1783 1783 return -ENOMEM; 1784 1784 ··· 1846 1846 { 1847 1847 int err, i; 1848 1848 1849 - c->ltab_cmt = vmalloc(array_size(sizeof(struct ubifs_lpt_lprops), 1850 - c->lpt_lebs)); 1849 + c->ltab_cmt = vmalloc_array(c->lpt_lebs, 1850 + sizeof(struct ubifs_lpt_lprops)); 1851 1851 if (!c->ltab_cmt) 1852 1852 return -ENOMEM; 1853 1853