mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 04:30:06 +01:00
Fix clang-tidy false positives
Array out of bounds complaints but it's a false positive where clang-tidy makes up some event flow that cannot happen. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1358>
This commit is contained in:
parent
941aa9f997
commit
4fd5fe9d30
6 changed files with 23 additions and 9 deletions
|
|
@ -39,7 +39,8 @@ libinput_strverscmp(const char *l0, const char *r0)
|
|||
|
||||
/* Find maximal matching prefix and track its maximal digit
|
||||
* suffix and whether those digits are all zeros. */
|
||||
for (dp = i = 0; l[i] == r[i]; i++) {
|
||||
for (dp = i = 0; l[i] == r[i]; /* NOLINT(clang-analyzer-security.ArrayBound) */
|
||||
i++) {
|
||||
int c = l[i];
|
||||
if (!c)
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1568,7 +1568,9 @@ quirk_merge_event_codes(struct quirks_context *ctx,
|
|||
newprop->type = property->type;
|
||||
newprop->value.tuples = property->value.tuples;
|
||||
/* Caller responsible for pre-allocating space */
|
||||
q->properties[q->nproperties++] = property_ref(newprop);
|
||||
q->properties[q->nproperties++] = /* NOLINT(clang-analyzer-security.ArrayBound)
|
||||
*/
|
||||
property_ref(newprop);
|
||||
list_append(&q->floating_properties, &newprop->link);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -200,6 +200,7 @@ strv_from_string(const char *in, const char *separators, size_t *num_elements)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
assert(idx < strv_len);
|
||||
strv[idx++] = copy;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ strv_free(char **strv)
|
|||
if (!strv)
|
||||
return;
|
||||
|
||||
while (*s != NULL) {
|
||||
while (*s != NULL) { /* NOLINT(clang-analyzer-security.ArrayBound) */
|
||||
free(*s);
|
||||
*s = (char *)0x1; /* detect use-after-free */
|
||||
s++;
|
||||
|
|
|
|||
|
|
@ -141,8 +141,13 @@ static void
|
|||
litest_init_test_devices(void)
|
||||
{
|
||||
const struct test_device *t;
|
||||
for (t = &__start_test_device_section; t < &__stop_test_device_section; t++)
|
||||
litest_add_test_device(&t->device->node);
|
||||
const struct test_device *start = &__start_test_device_section;
|
||||
const struct test_device *stop = &__stop_test_device_section;
|
||||
|
||||
for (t = start; t < stop; t++)
|
||||
litest_add_test_device(
|
||||
&t->device->node); /* NOLINT(clang-analyzer-security.ArrayBound)
|
||||
*/
|
||||
}
|
||||
|
||||
extern const struct test_collection __start_test_collection_section,
|
||||
|
|
@ -151,13 +156,18 @@ extern const struct test_collection __start_test_collection_section,
|
|||
static void
|
||||
setup_tests(void)
|
||||
{
|
||||
/* Iterate through linker-provided section boundaries.
|
||||
* These symbols mark the start and end of the test_collection_section. */
|
||||
const struct test_collection *start = &__start_test_collection_section;
|
||||
const struct test_collection *stop = &__stop_test_collection_section;
|
||||
const struct test_collection *c;
|
||||
|
||||
for (c = &__start_test_collection_section; c < &__stop_test_collection_section;
|
||||
c++) {
|
||||
for (c = start; c < stop;
|
||||
c++) { /* NOLINT(clang-analyzer-security.ArrayBound) */
|
||||
struct suite *s;
|
||||
s = zalloc(sizeof(*s));
|
||||
s->name = safe_strdup(c->name);
|
||||
s->name = safe_strdup(
|
||||
c->name); /* NOLINT(clang-analyzer-security.ArrayBound) */
|
||||
|
||||
list_init(&s->tests);
|
||||
list_append(&all_test_suites, &s->node);
|
||||
|
|
|
|||
|
|
@ -631,7 +631,7 @@ struct axis_replacement {
|
|||
static inline void
|
||||
litest_axis_set_value_unchecked(struct axis_replacement *axes, int code, double value)
|
||||
{
|
||||
while (axes->evcode != -1) {
|
||||
while (axes->evcode != -1) { /* NOLINT(clang-analyzer-security.ArrayBound) */
|
||||
if (axes->evcode == code) {
|
||||
axes->value = value;
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue