Changeset b389f95 in mainline


Ignore:
Timestamp:
2018-11-09T22:03:24Z (5 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4f3aa76
Parents:
deacd722
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-11-08 02:55:57)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-11-09 22:03:24)
Message:

Allow as_get_area_info() to fail

Location:
kernel/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/mm/as.h

    rdeacd722 rb389f95  
    325325
    326326/* Introspection functions. */
    327 extern void as_get_area_info(as_t *, as_area_info_t **, size_t *);
     327extern as_area_info_t *as_get_area_info(as_t *, size_t *);
    328328extern void as_print(as_t *);
    329329
  • kernel/generic/src/mm/as.c

    rdeacd722 rb389f95  
    22372237 *
    22382238 */
    2239 void as_get_area_info(as_t *as, as_area_info_t **obuf, size_t *osize)
     2239as_area_info_t *as_get_area_info(as_t *as, size_t *osize)
    22402240{
    22412241        mutex_lock(&as->lock);
     
    22452245
    22462246        size_t isize = area_cnt * sizeof(as_area_info_t);
    2247         as_area_info_t *info = nfmalloc(isize);
     2247        as_area_info_t *info = malloc(isize);
     2248        if (!info) {
     2249                mutex_unlock(&as->lock);
     2250                return NULL;
     2251        }
    22482252
    22492253        /* Record area data. */
     
    22672271        mutex_unlock(&as->lock);
    22682272
    2269         *obuf = info;
    22702273        *osize = isize;
     2274        return info;
    22712275}
    22722276
  • kernel/generic/src/udebug/udebug_ipc.c

    rdeacd722 rb389f95  
    266266        size_t data_size;
    267267        size_t buf_size;
    268         void *data;
     268        as_area_info_t *data;
    269269
    270270        uspace_addr = IPC_GET_ARG2(call->data); /* Destination address */
     
    274274         * Read area list.
    275275         */
    276         as_get_area_info(AS, (as_area_info_t **) &data, &data_size);
     276        data = as_get_area_info(AS, &data_size);
     277        if (!data) {
     278                IPC_SET_RETVAL(call->data, ENOMEM);
     279                ipc_answer(&TASK->kb.box, call);
     280                return;
     281        }
    277282
    278283        /* Copy MAX(buf_size, data_size) bytes */
     
    297302
    298303        IPC_SET_ARG3(call->data, data_size);
    299         call->buffer = data;
     304        call->buffer = (uint8_t *) data;
    300305
    301306        ipc_answer(&TASK->kb.box, call);
Note: See TracChangeset for help on using the changeset viewer.