From Murai Takashi <tmurai01@xxxxxxxxx>:
Murai Takashi has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/2223 ;)
Change subject: ntfs: Fix PVS V595
......................................................................
ntfs: Fix PVS V595
Check pointers against NULL befor using them.
Change-Id: I84fc7d60179fff46f78302e212bbcf7e5105126b
---
M src/add-ons/kernel/file_systems/ntfs/volume_util.c
1 file changed, 16 insertions(+), 7 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/23/2223/1
diff --git a/src/add-ons/kernel/file_systems/ntfs/volume_util.c
b/src/add-ons/kernel/file_systems/ntfs/volume_util.c
index 59dda3d..c7a5b8f 100644
--- a/src/add-ons/kernel/file_systems/ntfs/volume_util.c
+++ b/src/add-ons/kernel/file_systems/ntfs/volume_util.c
@@ -63,17 +63,26 @@
int ntfs_calc_free_space(nspace *_ns)
{
- nspace *ns = (nspace*)_ns;
- ntfs_volume *vol = ns->ntvol;
- ntfs_attr *data = vol->lcnbmp_na;
+ nspace *ns;
+ ntfs_volume *vol;
+ ntfs_attr *data;
s64 free_clusters = 0;
off_t pos = 0;
size_t readed;
- unsigned char *buf = NULL;
-
- if (ns == NULL || vol == NULL || data == NULL)
+ unsigned char *buf;
+
+ ns = (nspace*)_ns;
+ if (ns == NULL)
return -1;
-
+
+ vol = ns->ntvol;
+ if (vol == NULL)
+ return -1;
+
+ data = vol->lcnbmp_na;
+ if (data == NULL)
+ return -1;
+
if (vol->lcnbmp_na == NULL)
return -1;
--
To view, visit https://review.haiku-os.org/c/haiku/+/2223
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I84fc7d60179fff46f78302e212bbcf7e5105126b
Gerrit-Change-Number: 2223
Gerrit-PatchSet: 1
Gerrit-Owner: Murai Takashi <tmurai01@xxxxxxxxx>
Gerrit-MessageType: newchange