Re: [PATCH v2] 9p/net: fix improper handling of bogus negative read/write replies
From: Dominique Martinet
Date: Wed Mar 19 2025 - 05:51:49 EST
Christian Schoenebeck wrote on Wed, Mar 19, 2025 at 10:20:05AM +0100:
> > - p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %d (/%d)\n",
> > + p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %zu (/%zu)\n",
> > fid->fid, offset, rsize, count);
>
> p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %u (/%zu)\n",
> fid->fid, offset, rsize, count);
> > if (rsize < written) {
> > - pr_err("bogus RWRITE count (%d > %d)\n", written, rsize);
> > + pr_err("bogus RWRITE count (%u > %zu)\n", written, rsize);
>
> pr_err("bogus RWRITE count (%u > %u)\n", written, rsize);
(Right, got these two as they cause a warning with W=1)
> > int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset)
> > {
> > - int err, rsize, non_zc = 0;
> > + int err, non_zc = 0;
> > + u32 rsize;
> > struct p9_client *clnt;
> > struct p9_req_t *req;
> > char *dataptr;
>
> Missing change for:
>
> p9_debug(P9_DEBUG_9P, ">>> TREADDIR fid %d offset %llu count %u",
> fid->fid, offset, count);
Oh, this one doesn't seem to cause a warning.
I guess it doesn't matter much unless we get something > 2^31 but might
as well fix, sending as a v2
--
Dominique