kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ocfs2: remove some impossible checks
@ 2013-11-07  7:42 Dan Carpenter
  2013-11-07 22:02 ` Goldwyn Rodrigues
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-11-07  7:42 UTC (permalink / raw)
  To: ocfs2-devel

pv_major and pv_minor are unsigned char type so these checks are just
noise.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index 4599de7..eca3f93 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -808,11 +808,7 @@ static int lvb_to_version(char *lvb, struct ocfs2_protocol_version *ver)
 		&ocfs2_user_plugin.sp_max_proto;
 
 	memcpy(&pv, lvb, sizeof(struct ocfs2_protocol_version));
-	if ((pv.pv_major = LONG_MIN) || (pv.pv_major = LONG_MAX) ||
-	    (pv.pv_major > (u8)-1) || (pv.pv_major < 1))
-		return -ERANGE;
-	if ((pv.pv_minor = LONG_MIN) || (pv.pv_minor = LONG_MAX) ||
-	    (pv.pv_minor > (u8)-1) || (pv.pv_minor < 0))
+	if (pv.pv_major < 1)
 		return -ERANGE;
 	if ((pv.pv_major != max->pv_major) ||
 	    (pv.pv_minor > max->pv_minor))

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] ocfs2: remove some impossible checks
  2013-11-07  7:42 [patch] ocfs2: remove some impossible checks Dan Carpenter
@ 2013-11-07 22:02 ` Goldwyn Rodrigues
  0 siblings, 0 replies; 2+ messages in thread
From: Goldwyn Rodrigues @ 2013-11-07 22:02 UTC (permalink / raw)
  To: ocfs2-devel

On 11/07/2013 01:42 AM, Dan Carpenter wrote:
> pv_major and pv_minor are unsigned char type so these checks are just
> noise.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks. I will incorporate these changes alongwith Mark Fasheh's review 
comments

>
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index 4599de7..eca3f93 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -808,11 +808,7 @@ static int lvb_to_version(char *lvb, struct ocfs2_protocol_version *ver)
>   		&ocfs2_user_plugin.sp_max_proto;
>
>   	memcpy(&pv, lvb, sizeof(struct ocfs2_protocol_version));
> -	if ((pv.pv_major = LONG_MIN) || (pv.pv_major = LONG_MAX) ||
> -	    (pv.pv_major > (u8)-1) || (pv.pv_major < 1))
> -		return -ERANGE;
> -	if ((pv.pv_minor = LONG_MIN) || (pv.pv_minor = LONG_MAX) ||
> -	    (pv.pv_minor > (u8)-1) || (pv.pv_minor < 0))
> +	if (pv.pv_major < 1)
>   		return -ERANGE;
>   	if ((pv.pv_major != max->pv_major) ||
>   	    (pv.pv_minor > max->pv_minor))
>


-- 
Goldwyn

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-07 22:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-07  7:42 [patch] ocfs2: remove some impossible checks Dan Carpenter
2013-11-07 22:02 ` Goldwyn Rodrigues

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).