diff mbox

[4/4] efi_runtime: clean up some comments and unused code

Message ID 1470649228-15522-4-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show

Commit Message

Ivan Hu Aug. 8, 2016, 9:40 a.m. UTC
Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 efi_runtime/efi_runtime.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

Comments

Alex Hung Aug. 10, 2016, 3:06 a.m. UTC | #1
On 2016-08-08 05:40 PM, Ivan Hu wrote:
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  efi_runtime/efi_runtime.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index 57d4350..1c4f9c4 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
> @@ -30,8 +30,6 @@
>
>  #include "efi_runtime.h"
>
> -#define EFI_FWTS_EFI_VERSION	"0.1"
> -
>  MODULE_AUTHOR("Ivan Hu");
>  MODULE_DESCRIPTION("EFI Runtime Driver");
>  MODULE_LICENSE("GPL");
> @@ -93,7 +91,7 @@ copy_ucs2_from_user_len(uint16_t **dst, uint16_t __user *src, size_t len)
>
>  	buf = kmalloc(len, GFP_KERNEL);
>  	if (!buf) {
> -		*dst = 0;
> +		*dst = NULL;
>  		return -ENOMEM;
>  	}
>  	*dst = buf;
> @@ -188,7 +186,6 @@ static long efi_runtime_get_variable(unsigned long arg)
>  	    get_user(datasize, getvariable_local.data_size))
>  		return -EFAULT;
>  	if (getvariable_local.vendor_guid) {
> -
>  		if (copy_from_user(&vendor_guid, getvariable_local.vendor_guid,
>  			   sizeof(vendor_guid)))
>  			return -EFAULT;
> @@ -457,12 +454,12 @@ static long efi_runtime_get_nextvariablename(unsigned long arg)
>  		if (rv)
>  			return rv;
>  		/*
> -		 * name_size may be smaller than the real buffer size where
> -		 * VariableName located in some use cases. The most typical
> -		 * case is passing a 0 toget the required buffer size for the
> +		 * The name_size may be smaller than the real buffer size where
> +		 * variable name located in some use cases. The most typical
> +		 * case is passing a 0 to get the required buffer size for the
>  		 * 1st time call. So we need to copy the content from user
> -		 * space for at least the string size ofVariableName, or else
> -		 * the name passed to UEFI may not be terminatedas we expected.
> +		 * space for at least the string size of variable name, or else
> +		 * the name passed to UEFI may not be terminated as we expected.
>  		 */
>  		rv = copy_ucs2_from_user_len(&name,
>  				getnextvariablename_local.variable_name,
> @@ -594,7 +591,7 @@ static long efi_runtime_query_capsulecaps(unsigned long arg)
>  	for (i = 0; i < caps.capsule_count; i++) {
>  		efi_capsule_header_t *c;
>  		/*
> -		 * We cannot dereference caps.CapsuleHeaderArray directly to
> +		 * We cannot dereference caps.capsule_header_array directly to
>  		 * obtain the address of the capsule as it resides in the
>  		 * user space
>  		 */
>


Acked-by: Alex Hung <alex.hung@canonical.com>
Colin Ian King Aug. 11, 2016, 8:49 a.m. UTC | #2
On 08/08/16 10:40, Ivan Hu wrote:
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  efi_runtime/efi_runtime.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index 57d4350..1c4f9c4 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
> @@ -30,8 +30,6 @@
>  
>  #include "efi_runtime.h"
>  
> -#define EFI_FWTS_EFI_VERSION	"0.1"
> -
>  MODULE_AUTHOR("Ivan Hu");
>  MODULE_DESCRIPTION("EFI Runtime Driver");
>  MODULE_LICENSE("GPL");
> @@ -93,7 +91,7 @@ copy_ucs2_from_user_len(uint16_t **dst, uint16_t __user *src, size_t len)
>  
>  	buf = kmalloc(len, GFP_KERNEL);
>  	if (!buf) {
> -		*dst = 0;
> +		*dst = NULL;
>  		return -ENOMEM;
>  	}
>  	*dst = buf;
> @@ -188,7 +186,6 @@ static long efi_runtime_get_variable(unsigned long arg)
>  	    get_user(datasize, getvariable_local.data_size))
>  		return -EFAULT;
>  	if (getvariable_local.vendor_guid) {
> -
>  		if (copy_from_user(&vendor_guid, getvariable_local.vendor_guid,
>  			   sizeof(vendor_guid)))
>  			return -EFAULT;
> @@ -457,12 +454,12 @@ static long efi_runtime_get_nextvariablename(unsigned long arg)
>  		if (rv)
>  			return rv;
>  		/*
> -		 * name_size may be smaller than the real buffer size where
> -		 * VariableName located in some use cases. The most typical
> -		 * case is passing a 0 toget the required buffer size for the
> +		 * The name_size may be smaller than the real buffer size where
> +		 * variable name located in some use cases. The most typical
> +		 * case is passing a 0 to get the required buffer size for the
>  		 * 1st time call. So we need to copy the content from user
> -		 * space for at least the string size ofVariableName, or else
> -		 * the name passed to UEFI may not be terminatedas we expected.
> +		 * space for at least the string size of variable name, or else
> +		 * the name passed to UEFI may not be terminated as we expected.
>  		 */
>  		rv = copy_ucs2_from_user_len(&name,
>  				getnextvariablename_local.variable_name,
> @@ -594,7 +591,7 @@ static long efi_runtime_query_capsulecaps(unsigned long arg)
>  	for (i = 0; i < caps.capsule_count; i++) {
>  		efi_capsule_header_t *c;
>  		/*
> -		 * We cannot dereference caps.CapsuleHeaderArray directly to
> +		 * We cannot dereference caps.capsule_header_array directly to
>  		 * obtain the address of the capsule as it resides in the
>  		 * user space
>  		 */
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
diff mbox

Patch

diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
index 57d4350..1c4f9c4 100644
--- a/efi_runtime/efi_runtime.c
+++ b/efi_runtime/efi_runtime.c
@@ -30,8 +30,6 @@ 
 
 #include "efi_runtime.h"
 
-#define EFI_FWTS_EFI_VERSION	"0.1"
-
 MODULE_AUTHOR("Ivan Hu");
 MODULE_DESCRIPTION("EFI Runtime Driver");
 MODULE_LICENSE("GPL");
@@ -93,7 +91,7 @@  copy_ucs2_from_user_len(uint16_t **dst, uint16_t __user *src, size_t len)
 
 	buf = kmalloc(len, GFP_KERNEL);
 	if (!buf) {
-		*dst = 0;
+		*dst = NULL;
 		return -ENOMEM;
 	}
 	*dst = buf;
@@ -188,7 +186,6 @@  static long efi_runtime_get_variable(unsigned long arg)
 	    get_user(datasize, getvariable_local.data_size))
 		return -EFAULT;
 	if (getvariable_local.vendor_guid) {
-
 		if (copy_from_user(&vendor_guid, getvariable_local.vendor_guid,
 			   sizeof(vendor_guid)))
 			return -EFAULT;
@@ -457,12 +454,12 @@  static long efi_runtime_get_nextvariablename(unsigned long arg)
 		if (rv)
 			return rv;
 		/*
-		 * name_size may be smaller than the real buffer size where
-		 * VariableName located in some use cases. The most typical
-		 * case is passing a 0 toget the required buffer size for the
+		 * The name_size may be smaller than the real buffer size where
+		 * variable name located in some use cases. The most typical
+		 * case is passing a 0 to get the required buffer size for the
 		 * 1st time call. So we need to copy the content from user
-		 * space for at least the string size ofVariableName, or else
-		 * the name passed to UEFI may not be terminatedas we expected.
+		 * space for at least the string size of variable name, or else
+		 * the name passed to UEFI may not be terminated as we expected.
 		 */
 		rv = copy_ucs2_from_user_len(&name,
 				getnextvariablename_local.variable_name,
@@ -594,7 +591,7 @@  static long efi_runtime_query_capsulecaps(unsigned long arg)
 	for (i = 0; i < caps.capsule_count; i++) {
 		efi_capsule_header_t *c;
 		/*
-		 * We cannot dereference caps.CapsuleHeaderArray directly to
+		 * We cannot dereference caps.capsule_header_array directly to
 		 * obtain the address of the capsule as it resides in the
 		 * user space
 		 */