watch_queue: Fix filter limit check
[platform/kernel/linux-starfive.git] / kernel / watch_queue.c
index 9c9eb20..427b031 100644 (file)
@@ -320,7 +320,7 @@ long watch_queue_set_filter(struct pipe_inode_info *pipe,
                    tf[i].info_mask & WATCH_INFO_LENGTH)
                        goto err_filter;
                /* Ignore any unknown types */
-               if (tf[i].type >= sizeof(wfilter->type_filter) * 8)
+               if (tf[i].type >= WATCH_TYPE__NR)
                        continue;
                nr_filter++;
        }
@@ -336,7 +336,7 @@ long watch_queue_set_filter(struct pipe_inode_info *pipe,
 
        q = wfilter->filters;
        for (i = 0; i < filter.nr_filters; i++) {
-               if (tf[i].type >= sizeof(wfilter->type_filter) * BITS_PER_LONG)
+               if (tf[i].type >= WATCH_TYPE__NR)
                        continue;
 
                q->type                 = tf[i].type;