Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1224251

Re: [PATCH] debugfs: don't access 4 bytes for a boolean

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH] debugfs: don't access 4 bytes for a boolean
Date 2015-09-14 17:30 +0200
Message-ID <q8DRE-1Is-31@gated-at.bofh.it> (permalink)
References <q7svf-5vh-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Friday 11 September 2015 14:36:06 Viresh Kumar wrote:
> 
> debugfs_create_bool() declares the pointer to be of type u32 *.
> Shouldn't that be changed to u8 *? There are many users which are
> typecasting the variables to make debugfs API happy 

I'd say that the argument to debugfs_create_bool() has to match the
access in the functions you are modifying, as well as whatever
gets passed into it by callers.

By accessing only the first byte, you break all drivers that
call debugfs_create_bool() with a four-byte argument, at least
on big-endian systems!

If we change any part of this, we need to audit the existing 31 callers
of the function and change them all to use a bool type.

In the problem that you saw, what prevented gcc from printing a
compile-time warning about debugfs_create_bool() being called with
a bool argument?

	Arnd
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] debugfs: don't access 4 bytes for a boolean Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-11 11:10 +0200
  Re: [PATCH] debugfs: don't access 4 bytes for a boolean Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-11 13:20 +0200
    Re: [PATCH] debugfs: don't access 4 bytes for a boolean Greg KH <gregkh@linuxfoundation.org> - 2015-09-11 18:50 +0200
  Re: [PATCH] debugfs: don't access 4 bytes for a boolean Arnd Bergmann <arnd@arndb.de> - 2015-09-14 17:30 +0200
    Re: [PATCH] debugfs: don't access 4 bytes for a boolean Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-14 17:40 +0200

csiph-web