]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
keys: keyctl_pkey: replace BUG with return -EOPNOTSUPP
authorMohammed EL Kadiri <med08elkadiri@gmail.com>
Mon, 15 Jun 2026 12:11:50 +0000 (15:11 +0300)
committerJarkko Sakkinen <jarkko@kernel.org>
Mon, 15 Jun 2026 12:19:13 +0000 (15:19 +0300)
Replace two BUG() calls in keyctl_pkey_params_get_2() and
keyctl_pkey_e_d_s() default cases with -EOPNOTSUPP, matching
the error style already used in these functions.

Signed-off-by: Mohammed EL Kadiri <med08elkadiri@gmail.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
security/keys/keyctl_pkey.c

index ba150ee2d4a37d7cd7da85830f8fdc54ba2967cd..15b6bf6399b5909586aaa033e8e22d086ca7c2a0 100644 (file)
@@ -163,7 +163,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par
                params->out_len = info.max_sig_size;
                break;
        default:
-               BUG();
+               return -EOPNOTSUPP;
        }
 
        params->in_len  = uparams.in_len;
@@ -245,7 +245,8 @@ long keyctl_pkey_e_d_s(int op,
                params.op = kernel_pkey_sign;
                break;
        default:
-               BUG();
+               ret = -EOPNOTSUPP;
+               goto error_params;
        }
 
        in = memdup_user(_in, params.in_len);