From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Kirill A. Shutemov" Subject: Re: [V9fs-developer] [PATCH] 9p: use unsinged integers for nwqid/count Date: Wed, 7 Jan 2015 14:06:10 +0200 Message-ID: <20150107120610.GA6378@node.dhcp.inet.fi> References: <1419900489-44041-1-git-send-email-kirill.shutemov@linux.intel.com> <20150106130402.GB15671@u-galfione> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Kirill A. Shutemov" , Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , linux-fsdevel@vger.kernel.org, v9fs-developer@lists.sourceforge.net To: Dominique Martinet Return-path: Received: from mta-out1.inet.fi ([62.71.2.227]:46907 "EHLO jenni1.inet.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751783AbbAGMGk (ORCPT ); Wed, 7 Jan 2015 07:06:40 -0500 Content-Disposition: inline In-Reply-To: <20150106130402.GB15671@u-galfione> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Jan 06, 2015 at 02:04:02PM +0100, Dominique Martinet wrote: > Hi, > > Kirill A. Shutemov wrote on Tue, Dec 30, 2014 at 02:48:09AM +0200: > > @@ -273,7 +273,7 @@ p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt, > > } > > break; > > case 'R':{ > > - int16_t *nwqid = va_arg(ap, int16_t *); > > + uint16_t *nwqid = va_arg(ap, uint16_t *); > > struct p9_qid **wqids = > > va_arg(ap, struct p9_qid **); > > > > Good find there! > > Given we also have pdu->size, would it make sense to check nwqid through > this? > I'd need to check but I'd assume we should always have, after reading > nwqid, pdu->size - pdu->offset >= *nwqid * 13 (size of qid on the wire) Other option is to ask caller for upper limit. Since it's reply to Twalk request, we should never see nwqid > nwname on request. -- Kirill A. Shutemov