- Notifications
You must be signed in to change notification settings - Fork5
Commita0382e2
committed
Make partition-lock-release coding more transparent in BufferAlloc().
Coverity complained that oldPartitionLock was possibly dereferenced afterhaving been set to NULL. That actually can't happen, because we'd only useit if (oldFlags & BM_TAG_VALID) is true. But nonetheless Coverity isjustified in complaining, because at line 1275 we actually overwriteoldFlags, and then still expect its BM_TAG_VALID bit to be a safe guide towhether to release the oldPartitionLock. Thus, the code would be incorrectif someone else had changed the buffer's BM_TAG_VALID flag meanwhile.That should not happen, since we hold pin on the buffer throughout thissequence, but it's starting to look like a rather shaky chain of logic.And there's no need for such assumptions, because we can simply replacethe (oldFlags & BM_TAG_VALID) tests with (oldPartitionLock != NULL),which has identical results and makes it plain to all comers that we don'tdereference a null pointer. A small side benefit is that the range ofliveness of oldFlags is greatly reduced, possibly allowing the compilerto save a register.This is just cleanup, not an actual bug fix, so there seems no needfor a back-patch.1 parent75c24d0 commita0382e2
1 file changed
+6
-5
lines changedLines changed: 6 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1198 | 1198 |
| |
1199 | 1199 |
| |
1200 | 1200 |
| |
1201 |
| - | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
1202 | 1204 |
| |
1203 |
| - | |
1204 | 1205 |
| |
1205 | 1206 |
| |
1206 | 1207 |
| |
| |||
1223 | 1224 |
| |
1224 | 1225 |
| |
1225 | 1226 |
| |
1226 |
| - | |
| 1227 | + | |
1227 | 1228 |
| |
1228 | 1229 |
| |
1229 | 1230 |
| |
| |||
1277 | 1278 |
| |
1278 | 1279 |
| |
1279 | 1280 |
| |
1280 |
| - | |
| 1281 | + | |
1281 | 1282 |
| |
1282 | 1283 |
| |
1283 | 1284 |
| |
| |||
1303 | 1304 |
| |
1304 | 1305 |
| |
1305 | 1306 |
| |
1306 |
| - | |
| 1307 | + | |
1307 | 1308 |
| |
1308 | 1309 |
| |
1309 | 1310 |
| |
|
0 commit comments
Comments
(0)