From: "M. Mohan Kumar" <mohan@in.ibm.com>
To: v9fs-developer@lists.sourceforge.net
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [V9fs-developer] [PATCH] net/9p: Use proper data types
Date: Wed, 5 Jan 2011 22:37:42 +0530 [thread overview]
Message-ID: <201101052237.42802.mohan@in.ibm.com> (raw)
In-Reply-To: <1294246423-8454-1-git-send-email-mohan@in.ibm.com>
Commit 33551d7be66cec324c47990ed526b7fe327b011f net/9p/protocol.c: Remove
duplicated macros from Thiago Farina <tfransosi@gmail.com> exposed this issue
On Wednesday 05 January 2011 10:23:43 pm M. Mohan Kumar wrote:
> Use proper data types for storing the count of the binary blob and
> length of a string. Without this patch length calculation of string will
> always result in -1 because of comparision between signed and unsigned
> integer.
>
> Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
> ---
> net/9p/protocol.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/9p/protocol.c b/net/9p/protocol.c
> index c5180fd..2902eb1 100644
> --- a/net/9p/protocol.c
> +++ b/net/9p/protocol.c
> @@ -234,14 +234,14 @@ p9pdu_vreadf(struct p9_fcall *pdu, int proto_version,
> const char *fmt, }
> break;
> case 'D':{
> - int32_t *count = va_arg(ap, int32_t *);
> + uint32_t *count = va_arg(ap, int32_t *);
> void **data = va_arg(ap, void **);
>
> errcode =
> p9pdu_readf(pdu, proto_version, "d", count);
> if (!errcode) {
> *count =
> - min_t(int32_t, *count,
> + min_t(uint32_t, *count,
> pdu->size - pdu->offset);
> *data = &pdu->sdata[pdu->offset];
> }
> @@ -404,9 +404,9 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version,
> const char *fmt, break;
> case 's':{
> const char *sptr = va_arg(ap, const char *);
> - int16_t len = 0;
> + uint16_t len = 0;
> if (sptr)
> - len = min_t(int16_t, strlen(sptr),
> + len = min_t(uint16_t, strlen(sptr),
> USHRT_MAX);
>
> errcode = p9pdu_writef(pdu, proto_version,
----
M. Mohan Kumar
next prev parent reply other threads:[~2011-01-05 17:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-05 16:53 [PATCH] net/9p: Use proper data types M. Mohan Kumar
2011-01-05 17:07 ` M. Mohan Kumar [this message]
2011-01-05 23:30 ` [V9fs-developer] " Venkateswararao Jujjuri (JV)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201101052237.42802.mohan@in.ibm.com \
--to=mohan@in.ibm.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=v9fs-developer@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).