netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2/2] 9p: change an int to unsigned int
@ 2011-08-26 16:57 Dan Carpenter
  2011-08-30  7:38 ` Aneesh Kumar K.V
  2011-09-07 15:33 ` Venkateswararao Jujjuri
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2011-08-26 16:57 UTC (permalink / raw)
  To: Eric Van Hensbergen
  Cc: David S. Miller, Venkateswararao Jujjuri (JV), Aneesh Kumar K.V,
	M. Mohan Kumar, Stephen Hemminger, open list:NETWORKING [GENERAL],
	kernel-janitors

The size of things should be unsigned because negative sizes are
silly.  My concern is the the limit checks don't take negative values
into consideration in p9_client_create()
	if (clnt->msize > clnt->trans_mod->maxsize)
		clnt->msize = clnt->trans_mod->maxsize;
and in p9_tag_alloc()
	int alloc_msize = min(c->msize, max_size);

I don't know if this is exported to user space?  Hopefully it's not
too late to change this.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 55ce72c..d479d7d 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -151,7 +151,7 @@ struct p9_req_t {
 
 struct p9_client {
 	spinlock_t lock; /* protect client structure */
-	int msize;
+	unsigned int msize;
 	unsigned char proto_version;
 	struct p9_trans_module *trans_mod;
 	enum p9_trans_status status;

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

* Re: [patch 2/2] 9p: change an int to unsigned int
  2011-08-26 16:57 [patch 2/2] 9p: change an int to unsigned int Dan Carpenter
@ 2011-08-30  7:38 ` Aneesh Kumar K.V
  2011-09-07 15:33 ` Venkateswararao Jujjuri
  1 sibling, 0 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2011-08-30  7:38 UTC (permalink / raw)
  To: Dan Carpenter, Eric Van Hensbergen
  Cc: David S. Miller, Venkateswararao Jujjuri (JV), M. Mohan Kumar,
	Stephen Hemminger, open list:NETWORKING [GENERAL],
	kernel-janitors

On Fri, 26 Aug 2011 19:57:40 +0300, Dan Carpenter <error27@gmail.com> wrote:
> The size of things should be unsigned because negative sizes are
> silly.  My concern is the the limit checks don't take negative values
> into consideration in p9_client_create()
> 	if (clnt->msize > clnt->trans_mod->maxsize)
> 		clnt->msize = clnt->trans_mod->maxsize;
> and in p9_tag_alloc()
> 	int alloc_msize = min(c->msize, max_size);
> 
> I don't know if this is exported to user space?  Hopefully it's not
> too late to change this.

The change is also needed to make sure large msize value (429496729) works
Without the change it cause a server crash with Qemu 9p server.

> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/include/net/9p/client.h b/include/net/9p/client.h
> index 55ce72c..d479d7d 100644
> --- a/include/net/9p/client.h
> +++ b/include/net/9p/client.h
> @@ -151,7 +151,7 @@ struct p9_req_t {
> 
>  struct p9_client {
>  	spinlock_t lock; /* protect client structure */
> -	int msize;
> +	unsigned int msize;
>  	unsigned char proto_version;
>  	struct p9_trans_module *trans_mod;
>  	enum p9_trans_status status;

I applied this with comment update to 
git://git.kernel.org/pub/scm/linux/kernel/git/kvaneesh/v9fs.git for-upstream-next-merge

-aneesh

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

* Re: [patch 2/2] 9p: change an int to unsigned int
  2011-08-26 16:57 [patch 2/2] 9p: change an int to unsigned int Dan Carpenter
  2011-08-30  7:38 ` Aneesh Kumar K.V
@ 2011-09-07 15:33 ` Venkateswararao Jujjuri
  1 sibling, 0 replies; 3+ messages in thread
From: Venkateswararao Jujjuri @ 2011-09-07 15:33 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Eric Van Hensbergen, David S. Miller, Aneesh Kumar K.V,
	M. Mohan Kumar, Stephen Hemminger, open list:NETWORKING [GENERAL],
	kernel-janitors

On 08/26/2011 09:57 AM, Dan Carpenter wrote:
> The size of things should be unsigned because negative sizes are
> silly.  My concern is the the limit checks don't take negative values
> into consideration in p9_client_create()
> 	if (clnt->msize>  clnt->trans_mod->maxsize)
> 		clnt->msize = clnt->trans_mod->maxsize;
> and in p9_tag_alloc()
> 	int alloc_msize = min(c->msize, max_size);
>
> I don't know if this is exported to user space?  Hopefully it's not
> too late to change this.
It is not exported to user space but the other way is true;
  msize can be populate from mount option. It should be fine.
>
> Signed-off-by: Dan Carpenter<error27@gmail.com>
Reviewed-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
>
> diff --git a/include/net/9p/client.h b/include/net/9p/client.h
> index 55ce72c..d479d7d 100644
> --- a/include/net/9p/client.h
> +++ b/include/net/9p/client.h
> @@ -151,7 +151,7 @@ struct p9_req_t {
>
>   struct p9_client {
>   	spinlock_t lock; /* protect client structure */
> -	int msize;
> +	unsigned int msize;
>   	unsigned char proto_version;
>   	struct p9_trans_module *trans_mod;
>   	enum p9_trans_status status;

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

end of thread, other threads:[~2011-09-07 16:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-26 16:57 [patch 2/2] 9p: change an int to unsigned int Dan Carpenter
2011-08-30  7:38 ` Aneesh Kumar K.V
2011-09-07 15:33 ` Venkateswararao Jujjuri

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).