Ignore:
Timestamp:
2018-03-21T20:58:49Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3be9d10
Parents:
874381a
Message:

Make capability handles type-safe

Define distinct pointer types for the handles of the supported
capability types and use them instead of integer handles. This makes it
virtually impossible to pass a non-handle or a handle of different type
instead of the proper handle. Also turn cap_handle_t into an "untyped"
capability handle that can be assigned to and from the "typed" handles.

This commit also fixes a bug in msim-con driver, which wrongly used the
IRQ number instead of the IRQ capability handle to unregister the IRQ.

This commit also fixes the wrong use of the capability handle instead
of error code in libusbhost.

File:
1 edited

Legend:

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

    r874381a readaeae8  
    4545        task_t *other_task_s;
    4646
    47         kobject_t *sender_obj = kobject_get(TASK, IPC_GET_ARG5(call->data),
    48             KOBJECT_TYPE_PHONE);
     47        kobject_t *sender_obj = kobject_get(TASK,
     48            (cap_handle_t) IPC_GET_ARG5(call->data), KOBJECT_TYPE_PHONE);
    4949        if (!sender_obj)
    5050                return ENOENT;
     
    7878
    7979                kobject_t *recipient_obj = kobject_get(TASK,
    80                     IPC_GET_ARG1(answer->data), KOBJECT_TYPE_PHONE);
     80                    (cap_handle_t) IPC_GET_ARG1(answer->data),
     81                    KOBJECT_TYPE_PHONE);
    8182                if (!recipient_obj) {
    8283                        IPC_SET_RETVAL(answer->data, ENOENT);
Note: See TracChangeset for help on using the changeset viewer.