lkml.org 
[lkml]   [2004]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 1/44] Fix hid-core for devices with #usages < #values
    Date
    From
    You can pull this changeset from:
    bk://kernel.bkbits.net/vojtech/input

    ===================================================================

    ChangeSet@1.1474.188.1, 2004-01-26 13:15:32+01:00, jamesl@appliedminds.com
    input: Fix hid-core for devices that have less usages than values
    in a hid report. We could iterate beyond the end of array of
    usages before.


    hid-core.c | 11 +++++++++--
    1 files changed, 9 insertions(+), 2 deletions(-)

    ===================================================================

    diff -Nru a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
    --- a/drivers/usb/input/hid-core.c Tue Mar 16 13:20:15 2004
    +++ b/drivers/usb/input/hid-core.c Tue Mar 16 13:20:15 2004
    @@ -224,6 +224,9 @@
    offset = report->size;
    report->size += parser->global.report_size * parser->global.report_count;

    + if (usages < parser->global.report_count)
    + usages = parser->global.report_count;
    +
    if (usages == 0)
    return 0; /* ignore padding fields */

    @@ -235,9 +238,13 @@
    field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION);

    for (i = 0; i < usages; i++) {
    - field->usage[i].hid = parser->local.usage[i];
    + int j = i;
    + /* Duplicate the last usage we parsed if we have excess values */
    + if (i >= parser->local.usage_index)
    + j = parser->local.usage_index - 1;
    + field->usage[i].hid = parser->local.usage[j];
    field->usage[i].collection_index =
    - parser->local.collection_index[i];
    + parser->local.collection_index[j];
    }

    field->maxusage = usages;
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 14:01    [W:0.029 / U:0.120 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site