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

ppp: use vmalloc_array() to simplify code

Remove array_size() calls and replace vmalloc() with vmalloc_array() in
bsd_alloc().

vmalloc_array() is also optimized better, resulting in less instructions
being used.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Link: https://patch.msgid.link/20250816090659.117699-4-rongqianfeng@vivo.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Qianfeng Rong and committed by
Jakub Kicinski
dad32805 fce21458

+2 -2
+2 -2
drivers/net/ppp/bsd_comp.c
··· 406 406 * Allocate space for the dictionary. This may be more than one page in 407 407 * length. 408 408 */ 409 - db->dict = vmalloc(array_size(hsize, sizeof(struct bsd_dict))); 409 + db->dict = vmalloc_array(hsize, sizeof(struct bsd_dict)); 410 410 if (!db->dict) 411 411 { 412 412 bsd_free (db); ··· 425 425 */ 426 426 else 427 427 { 428 - db->lens = vmalloc(array_size(sizeof(db->lens[0]), (maxmaxcode + 1))); 428 + db->lens = vmalloc_array(maxmaxcode + 1, sizeof(db->lens[0])); 429 429 if (!db->lens) 430 430 { 431 431 bsd_free (db);