You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/11/08 18:53:00 UTC
[trafficserver] branch 9.2.x updated: Fix null-pointer-subtraction
warning (#8433)
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new a7acc44 Fix null-pointer-subtraction warning (#8433)
a7acc44 is described below
commit a7acc44a32df59b8da538998a3617b67599e195a
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Wed Oct 20 08:12:21 2021 +0900
Fix null-pointer-subtraction warning (#8433)
(cherry picked from commit 48f34d7b1421587e5a4643dd8e195dcab122aca4)
---
lib/records/RecRawStats.cc | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/records/RecRawStats.cc b/lib/records/RecRawStats.cc
index 59dee7f..9d87cba 100644
--- a/lib/records/RecRawStats.cc
+++ b/lib/records/RecRawStats.cc
@@ -576,9 +576,7 @@ RecRawStatUpdateSum(RecRawStatBlock *rsb, int id)
{
RecRawStat *raw = rsb->global[id];
if (nullptr != raw) {
- RecRecord *r = reinterpret_cast<RecRecord *>(reinterpret_cast<char *>(raw) -
- (reinterpret_cast<char *>(&reinterpret_cast<RecRecord *>(0)->stat_meta) -
- reinterpret_cast<char *>(reinterpret_cast<RecRecord *>(0))));
+ RecRecord *r = reinterpret_cast<RecRecord *>(reinterpret_cast<char *>(raw) - offsetof(struct RecRecord, stat_meta));
RecDataSetFromInt64(r->data_type, &r->data, rsb->global[id]->sum);
r->sync_required = REC_SYNC_REQUIRED;