These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / fs / coda / upcall.c
index 9b1ffaa..f6c6c8a 100644 (file)
@@ -353,7 +353,7 @@ int venus_readlink(struct super_block *sb, struct CodaFid *fid,
         char *result;
         
        insize = max_t(unsigned int,
-                    INSIZE(readlink), OUTSIZE(readlink)+ *length + 1);
+                    INSIZE(readlink), OUTSIZE(readlink)+ *length);
        UPARG(CODA_READLINK);
 
         inp->coda_readlink.VFid = *fid;
@@ -361,8 +361,8 @@ int venus_readlink(struct super_block *sb, struct CodaFid *fid,
        error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
        if (!error) {
                retlen = outp->coda_readlink.count;
-               if ( retlen > *length )
-                       retlen = *length;
+               if (retlen >= *length)
+                       retlen = *length - 1;
                *length = retlen;
                result =  (char *)outp + (long)outp->coda_readlink.data;
                memcpy(buffer, result, retlen);