Dear Linux Kernel Community, I am writing to seek clarification on a potential stack-out-of-bounds issue observed during the calls to for_each_set_bit function or find_first_bit function, specifically in the following code snippet: static struct cmd_info *find_cmd_entry_any_ring(struct intel_gvt *gvt, unsigned int opcode, int rings) { struct cmd_info *info = NULL; unsigned int ring; ... for_each_set_bit(ring, (unsigned long *)&rings, I915_NUM_ENGINES) { In the above code, a 32-bit integer pointer (rings) is being cast to a 64-bit unsigned long pointer, which leads to an extra 4 bytes being accessed. This raises a concern regarding a stack-out-of-bounds bug. My specific query is: While it is logically understandable that a write operation involving these extra 4 bytes could cause a kernel crash, in this case, it is a read operation that is occurring. Would such a read operation still be capable of crashing the kernel or resulting in unpredictable system behaviour? If so, could you please explain how that would happen? I appreciate your insights and look forward to your guidance on this issue. -- Thanks, Sekhar _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies