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

netlabel: remove impossible return value in netlbl_bitmap_walk

Since commit 446fda4f2682 ("[NetLabel]: CIPSOv4 engine"), *bitmap_walk
function only returns -1. Nearly 18 years have passed, -2 scenes never
come up, so there's no need to consider it.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Link: https://lore.kernel.org/r/20240227093604.3574241-1-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Zhengchao Shao and committed by
Jakub Kicinski
9ff74d77 3cbab892

+3 -9
+1 -4
net/ipv4/cipso_ipv4.c
··· 864 864 net_clen_bits, 865 865 net_spot + 1, 866 866 1); 867 - if (net_spot < 0) { 868 - if (net_spot == -2) 869 - return -EFAULT; 867 + if (net_spot < 0) 870 868 return 0; 871 - } 872 869 873 870 switch (doi_def->type) { 874 871 case CIPSO_V4_MAP_PASS:
+1 -4
net/ipv6/calipso.c
··· 657 657 net_clen_bits, 658 658 spot + 1, 659 659 1); 660 - if (spot < 0) { 661 - if (spot == -2) 662 - return -EFAULT; 660 + if (spot < 0) 663 661 return 0; 664 - } 665 662 666 663 ret_val = netlbl_catmap_setbit(&secattr->attr.mls.cat, 667 664 spot,
+1 -1
net/netlabel/netlabel_kapi.c
··· 876 876 * Description: 877 877 * Starting at @offset, walk the bitmap from left to right until either the 878 878 * desired bit is found or we reach the end. Return the bit offset, -1 if 879 - * not found, or -2 if error. 879 + * not found. 880 880 */ 881 881 int netlbl_bitmap_walk(const unsigned char *bitmap, u32 bitmap_len, 882 882 u32 offset, u8 state)