Skip to content

Commit 88e6c02

Browse files
committedApr 2, 2022
Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro: "Assorted bits and pieces" * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: aio: drop needless assignment in aio_read() clean overflow checks in count_mounts() a bit seq_file: fix NULL pointer arithmetic warning uml/x86: use x86 load_unaligned_zeropad() asm/user.h: killed unused macros constify struct path argument of finish_automount()/do_add_mount() fs: Remove FIXME comment in generic_write_checks()
2 parents a4251ab + 61e02cd commit 88e6c02

File tree

20 files changed

+18
-96
lines changed

20 files changed

+18
-96
lines changed
 

‎arch/alpha/include/asm/user.h

-6
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,4 @@ struct user {
4545
char u_comm[32]; /* user command name */
4646
};
4747

48-
#define NBPG PAGE_SIZE
49-
#define UPAGES 1
50-
#define HOST_TEXT_START_ADDR (u.start_code)
51-
#define HOST_DATA_START_ADDR (u.start_data)
52-
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
53-
5448
#endif /* _ALPHA_USER_H */

‎arch/arm/include/asm/user.h

-4
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ struct user{
7777
struct user_fp_struct * u_fp0;/* Used by gdb to help find the values for */
7878
/* the FP registers. */
7979
};
80-
#define NBPG PAGE_SIZE
81-
#define UPAGES 1
82-
#define HOST_TEXT_START_ADDR (u.start_code)
83-
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
8480

8581
/*
8682
* User specific VFP registers. If only VFPv2 is present, registers 16 to 31

‎arch/h8300/include/asm/user.h

-4
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,5 @@ struct user {
6767
unsigned long magic; /* To uniquely identify a core file */
6868
char u_comm[32]; /* User command that was responsible */
6969
};
70-
#define NBPG PAGE_SIZE
71-
#define UPAGES 1
72-
#define HOST_TEXT_START_ADDR (u.start_code)
73-
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
7470

7571
#endif

‎arch/ia64/include/asm/user.h

-6
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,4 @@ struct user {
5050
char u_comm[32]; /* user command name */
5151
};
5252

53-
#define NBPG PAGE_SIZE
54-
#define UPAGES 1
55-
#define HOST_TEXT_START_ADDR (u.start_code)
56-
#define HOST_DATA_START_ADDR (u.start_data)
57-
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
58-
5953
#endif /* _ASM_IA64_USER_H */

‎arch/m68k/include/asm/user.h

-4
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,5 @@ struct user{
7979
unsigned long magic; /* To uniquely identify a core file */
8080
char u_comm[32]; /* User command that was responsible */
8181
};
82-
#define NBPG 4096
83-
#define UPAGES 1
84-
#define HOST_TEXT_START_ADDR (u.start_code)
85-
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
8682

8783
#endif

‎arch/powerpc/include/asm/user.h

-5
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,4 @@ struct user {
4444
char u_comm[32]; /* user command name */
4545
};
4646

47-
#define NBPG PAGE_SIZE
48-
#define UPAGES 1
49-
#define HOST_TEXT_START_ADDR (u.start_code)
50-
#define HOST_DATA_START_ADDR (u.start_data)
51-
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
5247
#endif /* _ASM_POWERPC_USER_H */

‎arch/s390/include/asm/user.h

-4
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,5 @@ struct user {
6767
unsigned long magic; /* To uniquely identify a core file */
6868
char u_comm[32]; /* User command that was responsible */
6969
};
70-
#define NBPG PAGE_SIZE
71-
#define UPAGES 1
72-
#define HOST_TEXT_START_ADDR (u.start_code)
73-
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
7470

7571
#endif /* _S390_USER_H */

‎arch/sh/include/asm/user.h

-6
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,4 @@ struct user {
5252
char u_comm[32]; /* user command name */
5353
};
5454

55-
#define NBPG PAGE_SIZE
56-
#define UPAGES 1
57-
#define HOST_TEXT_START_ADDR (u.start_code)
58-
#define HOST_DATA_START_ADDR (u.start_data)
59-
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
60-
6155
#endif /* __ASM_SH_USER_H */

‎arch/um/include/asm/Kbuild

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ generic-y += softirq_stack.h
2424
generic-y += switch_to.h
2525
generic-y += topology.h
2626
generic-y += trace_clock.h
27-
generic-y += word-at-a-time.h
2827
generic-y += kprobes.h
2928
generic-y += mm_hooks.h
3029
generic-y += vga.h

‎arch/x86/include/asm/user_32.h

-4
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,5 @@ struct user{
124124
char u_comm[32]; /* User command that was responsible */
125125
int u_debugreg[8];
126126
};
127-
#define NBPG PAGE_SIZE
128-
#define UPAGES 1
129-
#define HOST_TEXT_START_ADDR (u.start_code)
130-
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
131127

132128
#endif /* _ASM_X86_USER_32_H */

‎arch/x86/include/asm/user_64.h

-4
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,5 @@ struct user {
130130
unsigned long error_code; /* CPU error code or 0 */
131131
unsigned long fault_address; /* CR3 or 0 */
132132
};
133-
#define NBPG PAGE_SIZE
134-
#define UPAGES 1
135-
#define HOST_TEXT_START_ADDR (u.start_code)
136-
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
137133

138134
#endif /* _ASM_X86_USER_64_H */

‎arch/x86/lib/csum-partial_64.c

-26
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ __wsum csum_partial(const void *buff, int len, __wsum sum)
9393
buff += 8;
9494
}
9595
if (len & 7) {
96-
#ifdef CONFIG_DCACHE_WORD_ACCESS
9796
unsigned int shift = (8 - (len & 7)) * 8;
9897
unsigned long trail;
9998

@@ -103,31 +102,6 @@ __wsum csum_partial(const void *buff, int len, __wsum sum)
103102
"adcq $0,%[res]"
104103
: [res] "+r" (temp64)
105104
: [trail] "r" (trail));
106-
#else
107-
if (len & 4) {
108-
asm("addq %[val],%[res]\n\t"
109-
"adcq $0,%[res]"
110-
: [res] "+r" (temp64)
111-
: [val] "r" ((u64)*(u32 *)buff)
112-
: "memory");
113-
buff += 4;
114-
}
115-
if (len & 2) {
116-
asm("addq %[val],%[res]\n\t"
117-
"adcq $0,%[res]"
118-
: [res] "+r" (temp64)
119-
: [val] "r" ((u64)*(u16 *)buff)
120-
: "memory");
121-
buff += 2;
122-
}
123-
if (len & 1) {
124-
asm("addq %[val],%[res]\n\t"
125-
"adcq $0,%[res]"
126-
: [res] "+r" (temp64)
127-
: [val] "r" ((u64)*(u8 *)buff)
128-
: "memory");
129-
}
130-
#endif
131105
}
132106
result = add32_with_carry(temp64 >> 32, temp64 & 0xffffffff);
133107
if (unlikely(odd)) {

‎arch/x86/um/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ endmenu
99
config UML_X86
1010
def_bool y
1111
select ARCH_BINFMT_ELF_EXTRA_PHDRS if X86_32
12+
select DCACHE_WORD_ACCESS
1213

1314
config 64BIT
1415
bool "64-bit kernel" if "$(SUBARCH)" = "x86"

‎fs/aio.c

-1
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,6 @@ static int aio_read(struct kiocb *req, const struct iocb *iocb,
15521552
file = req->ki_filp;
15531553
if (unlikely(!(file->f_mode & FMODE_READ)))
15541554
return -EBADF;
1555-
ret = -EINVAL;
15561555
if (unlikely(!file->f_op->read_iter))
15571556
return -EINVAL;
15581557

‎fs/internal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ int do_linkat(int olddfd, struct filename *old, int newdfd,
7474
* namespace.c
7575
*/
7676
extern struct vfsmount *lookup_mnt(const struct path *);
77-
extern int finish_automount(struct vfsmount *, struct path *);
77+
extern int finish_automount(struct vfsmount *, const struct path *);
7878

7979
extern int sb_prepare_remount_readonly(struct super_block *);
8080

‎fs/kernfs/file.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,8 @@ static void *kernfs_seq_start(struct seq_file *sf, loff_t *ppos)
120120
if (next == ERR_PTR(-ENODEV))
121121
kernfs_seq_stop_active(sf, next);
122122
return next;
123-
} else {
124-
/*
125-
* The same behavior and code as single_open(). Returns
126-
* !NULL if pos is at the beginning; otherwise, NULL.
127-
*/
128-
return NULL + !*ppos;
129123
}
124+
return single_start(sf, ppos);
130125
}
131126

132127
static void *kernfs_seq_next(struct seq_file *sf, void *v, loff_t *ppos)

‎fs/namespace.c

+12-11
Original file line numberDiff line numberDiff line change
@@ -2112,22 +2112,23 @@ static int invent_group_ids(struct mount *mnt, bool recurse)
21122112
int count_mounts(struct mnt_namespace *ns, struct mount *mnt)
21132113
{
21142114
unsigned int max = READ_ONCE(sysctl_mount_max);
2115-
unsigned int mounts = 0, old, pending, sum;
2115+
unsigned int mounts = 0;
21162116
struct mount *p;
21172117

2118+
if (ns->mounts >= max)
2119+
return -ENOSPC;
2120+
max -= ns->mounts;
2121+
if (ns->pending_mounts >= max)
2122+
return -ENOSPC;
2123+
max -= ns->pending_mounts;
2124+
21182125
for (p = mnt; p; p = next_mnt(p, mnt))
21192126
mounts++;
21202127

2121-
old = ns->mounts;
2122-
pending = ns->pending_mounts;
2123-
sum = old + pending;
2124-
if ((old > sum) ||
2125-
(pending > sum) ||
2126-
(max < sum) ||
2127-
(mounts > (max - sum)))
2128+
if (mounts > max)
21282129
return -ENOSPC;
21292130

2130-
ns->pending_mounts = pending + mounts;
2131+
ns->pending_mounts += mounts;
21312132
return 0;
21322133
}
21332134

@@ -2921,7 +2922,7 @@ static int do_move_mount_old(struct path *path, const char *old_name)
29212922
* add a mount into a namespace's mount tree
29222923
*/
29232924
static int do_add_mount(struct mount *newmnt, struct mountpoint *mp,
2924-
struct path *path, int mnt_flags)
2925+
const struct path *path, int mnt_flags)
29252926
{
29262927
struct mount *parent = real_mount(path->mnt);
29272928

@@ -3044,7 +3045,7 @@ static int do_new_mount(struct path *path, const char *fstype, int sb_flags,
30443045
return err;
30453046
}
30463047

3047-
int finish_automount(struct vfsmount *m, struct path *path)
3048+
int finish_automount(struct vfsmount *m, const struct path *path)
30483049
{
30493050
struct dentry *dentry = path->dentry;
30503051
struct mountpoint *mp;

‎fs/read_write.c

-1
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,6 @@ int generic_write_checks_count(struct kiocb *iocb, loff_t *count)
16301630
if (!*count)
16311631
return 0;
16321632

1633-
/* FIXME: this is for backwards compatibility with 2.4 */
16341633
if (iocb->ki_flags & IOCB_APPEND)
16351634
iocb->ki_pos = i_size_read(inode);
16361635

‎fs/seq_file.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,9 @@ int seq_dentry(struct seq_file *m, struct dentry *dentry, const char *esc)
554554
}
555555
EXPORT_SYMBOL(seq_dentry);
556556

557-
static void *single_start(struct seq_file *p, loff_t *pos)
557+
void *single_start(struct seq_file *p, loff_t *pos)
558558
{
559-
return NULL + (*pos == 0);
559+
return *pos ? NULL : SEQ_START_TOKEN;
560560
}
561561

562562
static void *single_next(struct seq_file *p, void *v, loff_t *pos)

‎include/linux/seq_file.h

+1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ int seq_dentry(struct seq_file *, struct dentry *, const char *);
162162
int seq_path_root(struct seq_file *m, const struct path *path,
163163
const struct path *root, const char *esc);
164164

165+
void *single_start(struct seq_file *, loff_t *);
165166
int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
166167
int single_open_size(struct file *, int (*)(struct seq_file *, void *), void *, size_t);
167168
int single_release(struct inode *, struct file *);

0 commit comments

Comments
 (0)
Please sign in to comment.