summaryrefslogtreecommitdiff
path: root/src/cuda-sim
diff options
context:
space:
mode:
authorNick <[email protected]>2019-09-03 10:21:51 -0400
committerNick <[email protected]>2019-09-03 10:21:51 -0400
commit7bc0007c0dac14528409d33ca1a28491a2568d12 (patch)
tree89a44f43be0e65ffd3f41fef50235400bf711457 /src/cuda-sim
parent13b2410ef3f178e7adb7d7b1d634648e6be37715 (diff)
get rid of more UB
Diffstat (limited to 'src/cuda-sim')
-rw-r--r--src/cuda-sim/ptx_loader.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc
index dca3cec..33bcf45 100644
--- a/src/cuda-sim/ptx_loader.cc
+++ b/src/cuda-sim/ptx_loader.cc
@@ -214,7 +214,8 @@ void fix_duplicate_errors(char fname2[1024]) {
long filesize = ftell(ptxsource);
rewind(ptxsource);
char *ptxdata = (char*)malloc((filesize+1)*sizeof(char));
- fread(ptxdata, filesize, 1, ptxsource);
+ // Fail if we do not read the file
+ assert(fread(ptxdata, filesize, 1, ptxsource) == 1);
fclose(ptxsource);
FILE *ptxdest = fopen(fname2,"w");