Ignore:
Timestamp:
2018-05-11T20:22:42Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d2c5159
Parents:
ae89656
Message:

Use atomic malloc allocations

We can safely use atomic allocations in places that use the non-failing
version of malloc(), but test the return value anyway. And also in some
places that can afford to return failure but did not because of comfort.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ops/dataread.c

    rae89656 r7473807  
    7575                        IPC_SET_ARG1(answer->data, dst);
    7676
    77                         answer->buffer = malloc(size, 0);
     77                        answer->buffer = malloc(size, FRAME_ATOMIC);
     78                        if (!answer->buffer) {
     79                                IPC_SET_RETVAL(answer->data, ENOMEM);
     80                                return EOK;
     81                        }
    7882                        errno_t rc = copy_from_uspace(answer->buffer,
    7983                            (void *) src, size);
     
    8488                                 * ipc_call_free().
    8589                                 */
     90                                return EOK;
    8691                        }
    8792                } else if (!size) {
Note: See TracChangeset for help on using the changeset viewer.