I'm writing a small kernel module designed solely for accessing a particular key using the kernel's key retention service. Since I couldn't find a simple function to return a key's contents given its ID, I had to resort to request_key as outlined in the kernel documentation.
This line is what gives the error:
struct key *my_key = request_key(&key_type_user, "test key", NULL);
I'm referencing the proper key type and I still get this error. The function in security/keys/request_key.c that my code should be calling is declared:
struct key *request_key(struct key_type *type,
const char *description,
const char *callout_info)
I don't see anything there about *type need to be a constant. I've read that the error message might have to do with false advertising on the part of C as to what makes something "constant", but I can't see how that could relate to the above function. Any help?
If that line is in a declaration section, it has the syntax of an initializer and that may be the compiler's complaint. Move any declarations which immediately follow it to be above it. Or split it: