initrd driver now properly handles a request to read more data than available

This commit is contained in:
pjht 2020-08-23 17:34:24 -05:00
parent ff2dbb91e1
commit edfb52936d

View File

@ -19,13 +19,7 @@ void read(void* args) {
rpc_deallocate_buf(args,state.sizeorpos);
long max_data=initrd_size-pos;
if (size>max_data) {
serial_print("Reading too much data from initrd\n");
state.buf=NULL;
state.sizeorpos=0;
serialize_int(0,&state);
rpc_return(state.buf,state.sizeorpos);
free(state.buf);
pthread_exit(NULL);
size=max_data;
}
char* data=malloc(sizeof(char)*size);
for (long i=0;i<size;i++) {