• R/O
  • HTTP
  • SSH
  • HTTPS

tomoyo-test1: コミット

This is a test repository.


コミットメタ情報

リビジョンd9594e0409651a237903a13c9718df889f43d43b (tree)
日時2020-10-28 23:21:43
作者Arnd Bergmann <arnd@arnd...>
コミッターTetsuo Handa

ログメッセージ

tomoyo: fix clang pointer arithmetic warning

clang warns about additions on NULL pointers being undefined in C:

security/tomoyo/securityfs_if.c:226:59: warning: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]

securityfs_create_file(name, mode, parent, ((u8 *) NULL) + key,

Change the code to instead use a cast through uintptr_t to avoid
the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

変更サマリ

差分

--- a/security/tomoyo/securityfs_if.c
+++ b/security/tomoyo/securityfs_if.c
@@ -131,8 +131,8 @@ static const struct file_operations tomoyo_self_operations = {
131131 */
132132 static int tomoyo_open(struct inode *inode, struct file *file)
133133 {
134- const int key = ((u8 *) file_inode(file)->i_private)
135- - ((u8 *) NULL);
134+ const u8 key = (uintptr_t) file_inode(file)->i_private;
135+
136136 return tomoyo_open_control(key, file);
137137 }
138138
@@ -223,7 +223,7 @@ static const struct file_operations tomoyo_operations = {
223223 static void __init tomoyo_create_entry(const char *name, const umode_t mode,
224224 struct dentry *parent, const u8 key)
225225 {
226- securityfs_create_file(name, mode, parent, ((u8 *) NULL) + key,
226+ securityfs_create_file(name, mode, parent, (void *) (uintptr_t) key,
227227 &tomoyo_operations);
228228 }
229229
旧リポジトリブラウザで表示