From 98e793a329fea75cc8be83c2310049cefc067364 Mon Sep 17 00:00:00 2001 From: David Smith Date: Tue, 7 Sep 2021 14:21:18 +0200 Subject: [PATCH] [Server] Use length returned by read and fix an alignment check in pgRead. --- src/XrdOss/XrdOss.cc | 2 +- src/XrdOuc/XrdOucCache.cc | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/XrdOss/XrdOss.cc b/src/XrdOss/XrdOss.cc index 79d4743f6c5..80b650035e4 100644 --- a/src/XrdOss/XrdOss.cc +++ b/src/XrdOss/XrdOss.cc @@ -172,7 +172,7 @@ ssize_t XrdOssDF::pgRead(void *buffer, // Calculate checksums if so wanted // if (bytes > 0 && csvec) - XrdOucPgrwUtils::csCalc((const char *)buffer, offset, rdlen, csvec); + XrdOucPgrwUtils::csCalc((const char *)buffer, offset, bytes, csvec); // All done // diff --git a/src/XrdOuc/XrdOucCache.cc b/src/XrdOuc/XrdOucCache.cc index a72b242e461..2a38f4664d6 100644 --- a/src/XrdOuc/XrdOucCache.cc +++ b/src/XrdOuc/XrdOucCache.cc @@ -44,12 +44,6 @@ int XrdOucCacheIO::pgRead(char *buff, { int bytes; -// Make sure the offset is on a 4K boundary and the size is a multiple of -// 4k as well (we use simple and for this). -// - if ((offs & XrdSys::PageMask) - || (rdlen & XrdSys::PageMask)) return -EINVAL; - // Read the data into the buffer // bytes = Read(buff, offs, rdlen); @@ -58,7 +52,7 @@ int XrdOucCacheIO::pgRead(char *buff, // if (bytes > 0 && (opts & forceCS)) XrdOucPgrwUtils::csCalc((const char *)buff, (ssize_t)offs, - (size_t)rdlen, csvec); + (size_t)bytes, csvec); // All done //