Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 128c6b6c authored by Paul Moore's avatar Paul Moore Committed by James Morris
Browse files

NetLabel: convert a BUG_ON in the CIPSO code to a runtime check



This patch changes a BUG_ON in the CIPSO code to a runtime check.  It should
also increase the readability of the code as it replaces an unexplained
constant with a well defined macro.

Signed-off-by: default avatarPaul Moore <paul.moore@hp.com>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent f998e8cb
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -1142,7 +1142,9 @@ static int cipso_v4_map_cat_rng_hton(const struct cipso_v4_doi *doi_def,
	u32 cat_size = 0;
	u32 cat_size = 0;


	/* make sure we don't overflow the 'array[]' variable */
	/* make sure we don't overflow the 'array[]' variable */
	BUG_ON(net_cat_len > 30);
	if (net_cat_len >
	    (CIPSO_V4_OPT_LEN_MAX - CIPSO_V4_HDR_LEN - CIPSO_V4_TAG_RNG_BLEN))
		return -ENOSPC;


	for (;;) {
	for (;;) {
		iter = netlbl_secattr_catmap_walk(secattr->mls_cat, iter + 1);
		iter = netlbl_secattr_catmap_walk(secattr->mls_cat, iter + 1);