get_current_system_password+ /* look up if user set a password for the requests */
+ current_password = get_current_password("Admin");
+ if (!current_password)
+ return -ENODEV;
Can we instead of passing "Admin" and "System" to this function
just have 2 separate get_current_admin_password and
helpers and then drop the error handling ?
The error handling for -ENODEV is actually important in case a WMI driver
was unbound.
strlen(current_password) ++
+ /* password is set */
+ if (strlen(current_password) > 0)
+ security_area_size = (sizeof(u32) * 2) +
ments,+ strlen(current_password) % 2;
+ /* password not set */
+ else
+ security_area_size = sizeof(u32) * 2;
Since you are using more then 1 line here please use {} around the state-
also please put the /* password not set */ after the else:2;
...
} else { /* password not set */
...
+ string_area_size = (strlen(a_name) + strlen(a_value))*2;
+ buffer_size = security_area_size + string_area_size + sizeof(u16) *
+
+ buffer = kzalloc(buffer_size, GFP_KERNEL);
Actually above looks like home grown kasprintf() implementation.
I don't think so, sprintf isn't used at all here. It's a calculation to determine
the size of the buffer to use.