History

Pull series refactoring quota enabling and disabling code.

Jan Kara committed 7 years ago

Commit dae82c72 parents a9913d7 a0828b6687 files · +6289 −6544Browse files

Showing the changes to include/linux (21 of 687 files). Show all

Unified · Split

21 files
  1. include/linux/bitmap.h +2 −1
  2. include/linux/bitops.h +7 −0
  3. include/linux/compiler_attributes.h +17 −0
  4. include/linux/dsa/sja1105.h +3 −1
  5. include/linux/export.h +5 −5
  6. include/linux/hwmon.h +1 −1
  7. include/linux/kvm_host.h +2 −0
  8. include/linux/leds.h +2 −3
  9. include/linux/memcontrol.h +29 −0
  10. include/linux/mii.h +9 −0
  11. include/linux/page_ext.h +9 −1
  12. include/linux/phy.h +2 −0
  13. include/linux/platform_device.h +2 −0
  14. include/linux/quotaops.h +3 −1
  15. include/linux/skbuff.h +1 −4
  16. include/linux/slab.h +4 −0
  17. include/linux/string.h +20 −1
  18. include/linux/sunrpc/xprtsock.h +1 −0
  19. include/linux/tpm_eventlog.h +12 −4
  20. include/linux/uaccess.h +74 −2
  21. include/linux/xarray.h +2 −2
include/linux/bitmap.h+2−1
@@ -326,10 +326,11 @@ static inline int bitmap_equal(const unsigned long *src1, · 325 unmodified lines
326326 }
327327
328328 /**
329− * bitmap_or_equal - Check whether the or of two bitnaps is equal to a third
329+ * bitmap_or_equal - Check whether the or of two bitmaps is equal to a third
330330 * @src1: Pointer to bitmap 1
331331 * @src2: Pointer to bitmap 2 will be or'ed with bitmap 1
332332 * @src3: Pointer to bitmap 3. Compare to the result of *@src1 | *@src2
333+ * @nbits: number of bits in each of these bitmaps
333334 *
334335 * Returns: True if (*@src1 | *@src2) == *@src3, false otherwise
335336 */
include/linux/bitops.h+7−0
@@ -4,6 +4,13 @@ · 3 unmodified lines
44 #include <asm/types.h>
55 #include <linux/bits.h>
66
7+/* Set bits in the first 'n' bytes when loaded from memory */
8+#ifdef __LITTLE_ENDIAN
9+# define aligned_byte_mask(n) ((1UL << 8*(n))-1)
10+#else
11+# define aligned_byte_mask(n) (~0xffUL << (BITS_PER_LONG - 8 - 8*(n)))
12+#endif
13+
714 #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
815 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
916
include/linux/compiler_attributes.h+17−0
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 # define __GCC4_has_attribute___noclone__ 1
4141 # define __GCC4_has_attribute___nonstring__ 0
4242 # define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8)
43+# define __GCC4_has_attribute___fallthrough__ 0
4344 #endif
4445
4546 /*
@@ -185,6 +186,22 @@ · 139 unmodified lines
185186 # define __noclone
186187 #endif
187188
189+/*
190+ * Add the pseudo keyword 'fallthrough' so case statement blocks
191+ * must end with any of these keywords:
192+ * break;
193+ * fallthrough;
194+ * goto <label>;
195+ * return [expression];
196+ *
197+ * gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
198+ */
199+#if __has_attribute(__fallthrough__)
200+# define fallthrough __attribute__((__fallthrough__))
201+#else
202+# define fallthrough do {} while (0) /* fallthrough */
203+#endif
204+
188205 /*
189206 * Note the missing underscores.
190207 *
include/linux/dsa/sja1105.h+3−1
@@ -31,6 +31,8 @@ · 30 unmodified lines
3131 #define SJA1105_META_SMAC 0x222222222222ull
3232 #define SJA1105_META_DMAC 0x0180C200000Eull
3333
34+#define SJA1105_HWTS_RX_EN 0
35+
3436 /* Global tagger data: each struct sja1105_port has a reference to
3537 * the structure defined in struct sja1105_private.
3638 */
@@ -42,7 +44,7 @@ struct sja1105_tagger_data { · 5 unmodified lines
4244 * from taggers running on multiple ports on SMP systems
4345 */
4446 spinlock_t meta_lock;
45− bool hwts_rx_en;
47+ unsigned long state;
4648 };
4749
4850 struct sja1105_skb_cb {
include/linux/export.h+5−5
@@ -52,10 +52,10 @@ extern struct module __this_module; · 51 unmodified lines
5252 __ADDRESSABLE(sym) \
5353 asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \
5454 " .balign 4 \n" \
55− "__ksymtab_" #sym NS_SEPARATOR #ns ": \n" \
55+ "__ksymtab_" #ns NS_SEPARATOR #sym ": \n" \
5656 " .long " #sym "- . \n" \
5757 " .long __kstrtab_" #sym "- . \n" \
58− " .long __kstrtab_ns_" #sym "- . \n" \
58+ " .long __kstrtabns_" #sym "- . \n" \
5959 " .previous \n")
6060
6161 #define __KSYMTAB_ENTRY(sym, sec) \
@@ -76,10 +76,10 @@ struct kernel_symbol { · 14 unmodified lines
7676 #else
7777 #define __KSYMTAB_ENTRY_NS(sym, sec, ns) \
7878 static const struct kernel_symbol __ksymtab_##sym##__##ns \
79− asm("__ksymtab_" #sym NS_SEPARATOR #ns) \
79+ asm("__ksymtab_" #ns NS_SEPARATOR #sym) \
8080 __attribute__((section("___ksymtab" sec "+" #sym), used)) \
8181 __aligned(sizeof(void *)) \
82− = { (unsigned long)&sym, __kstrtab_##sym, __kstrtab_ns_##sym }
82+ = { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym }
8383
8484 #define __KSYMTAB_ENTRY(sym, sec) \
8585 static const struct kernel_symbol __ksymtab_##sym \
@@ -112,7 +112,7 @@ struct kernel_symbol { · 26 unmodified lines
112112 /* For every exported symbol, place a struct in the __ksymtab section */
113113 #define ___EXPORT_SYMBOL_NS(sym, sec, ns) \
114114 ___export_symbol_common(sym, sec); \
115− static const char __kstrtab_ns_##sym[] \
115+ static const char __kstrtabns_##sym[] \
116116 __attribute__((section("__ksymtab_strings"), used, aligned(1))) \
117117 = #ns; \
118118 __KSYMTAB_ENTRY_NS(sym, sec, ns)
include/linux/hwmon.h+1−1
@@ -235,7 +235,7 @@ enum hwmon_power_attributes { · 234 unmodified lines
235235 #define HWMON_P_LABEL BIT(hwmon_power_label)
236236 #define HWMON_P_ALARM BIT(hwmon_power_alarm)
237237 #define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm)
238−#define HWMON_P_MIN_ALARM BIT(hwmon_power_max_alarm)
238+#define HWMON_P_MIN_ALARM BIT(hwmon_power_min_alarm)
239239 #define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm)
240240 #define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm)
241241 #define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm)
include/linux/kvm_host.h+2−0
@@ -1090,6 +1090,7 @@ enum kvm_stat_kind { · 1089 unmodified lines
10901090
10911091 struct kvm_stat_data {
10921092 int offset;
1093+ int mode;
10931094 struct kvm *kvm;
10941095 };
10951096
@@ -1097,6 +1098,7 @@ struct kvm_stats_debugfs_item { · 1 unmodified line
10971098 const char *name;
10981099 int offset;
10991100 enum kvm_stat_kind kind;
1101+ int mode;
11001102 };
11011103 extern struct kvm_stats_debugfs_item debugfs_entries[];
11021104 extern struct dentry *kvm_debugfs_dir;
include/linux/leds.h+2−3
@@ -247,7 +247,7 @@ extern void led_set_brightness(struct led_classdev *led_cdev, · 246 unmodified lines
247247 /**
248248 * led_set_brightness_sync - set LED brightness synchronously
249249 * @led_cdev: the LED to set
250− * @brightness: the brightness to set it to
250+ * @value: the brightness to set it to
251251 *
252252 * Set an LED's brightness immediately. This function will block
253253 * the caller for the time required for accessing device registers,
@@ -301,8 +301,7 @@ extern void led_sysfs_enable(struct led_classdev *led_cdev); · 47 unmodified lines
301301 /**
302302 * led_compose_name - compose LED class device name
303303 * @dev: LED controller device object
304− * @child: child fwnode_handle describing a LED or a group of synchronized LEDs;
305− * it must be provided only for fwnode based LEDs
304+ * @init_data: the LED class device initialization data
306305 * @led_classdev_name: composed LED class device name
307306 *
308307 * Create LED class device name basing on the provided init_data argument.
include/linux/memcontrol.h+29−0
@@ -356,6 +356,19 @@ static inline bool mem_cgroup_disabled(void) · 355 unmodified lines
356356 return !cgroup_subsys_enabled(memory_cgrp_subsys);
357357 }
358358
359+static inline unsigned long mem_cgroup_protection(struct mem_cgroup *memcg,
360+ bool in_low_reclaim)
361+{
362+ if (mem_cgroup_disabled())
363+ return 0;
364+
365+ if (in_low_reclaim)
366+ return READ_ONCE(memcg->memory.emin);
367+
368+ return max(READ_ONCE(memcg->memory.emin),
369+ READ_ONCE(memcg->memory.elow));
370+}
371+
359372 enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root,
360373 struct mem_cgroup *memcg);
361374
@@ -537,6 +550,8 @@ void mem_cgroup_handle_over_high(void); · 175 unmodified lines
537550
538551 unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg);
539552
553+unsigned long mem_cgroup_size(struct mem_cgroup *memcg);
554+
540555 void mem_cgroup_print_oom_context(struct mem_cgroup *memcg,
541556 struct task_struct *p);
542557
@@ -829,6 +844,12 @@ static inline void memcg_memory_event_mm(struct mm_struct *mm, · 286 unmodified lines
829844 {
830845 }
831846
847+static inline unsigned long mem_cgroup_protection(struct mem_cgroup *memcg,
848+ bool in_low_reclaim)
849+{
850+ return 0;
851+}
852+
832853 static inline enum mem_cgroup_protection mem_cgroup_protected(
833854 struct mem_cgroup *root, struct mem_cgroup *memcg)
834855 {
@@ -968,6 +989,11 @@ static inline unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg) · 133 unmodified lines
968989 return 0;
969990 }
970991
992+static inline unsigned long mem_cgroup_size(struct mem_cgroup *memcg)
993+{
994+ return 0;
995+}
996+
971997 static inline void
972998 mem_cgroup_print_oom_context(struct mem_cgroup *memcg, struct task_struct *p)
973999 {
@@ -1264,6 +1290,9 @@ void mem_cgroup_track_foreign_dirty_slowpath(struct page *page, · 290 unmodified lines
12641290 static inline void mem_cgroup_track_foreign_dirty(struct page *page,
12651291 struct bdi_writeback *wb)
12661292 {
1293+ if (mem_cgroup_disabled())
1294+ return;
1295+
12671296 if (unlikely(&page->mem_cgroup->css != wb->memcg_css))
12681297 mem_cgroup_track_foreign_dirty_slowpath(page, wb);
12691298 }
include/linux/mii.h+9−0
@@ -455,6 +455,15 @@ static inline void mii_lpa_mod_linkmode_lpa_t(unsigned long *lp_advertising, · 454 unmodified lines
455455 lp_advertising, lpa & LPA_LPACK);
456456 }
457457
458+static inline void mii_ctrl1000_mod_linkmode_adv_t(unsigned long *advertising,
459+ u32 ctrl1000)
460+{
461+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, advertising,
462+ ctrl1000 & ADVERTISE_1000HALF);
463+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, advertising,
464+ ctrl1000 & ADVERTISE_1000FULL);
465+}
466+
458467 /**
459468 * linkmode_adv_to_lcl_adv_t
460469 * @advertising:pointer to linkmode advertising
include/linux/page_ext.h+9−1
@@ -18,7 +18,7 @@ struct page_ext_operations { · 17 unmodified lines
1818
1919 enum page_ext_flags {
2020 PAGE_EXT_OWNER,
21− PAGE_EXT_OWNER_ACTIVE,
21+ PAGE_EXT_OWNER_ALLOCATED,
2222 #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
2323 PAGE_EXT_YOUNG,
2424 PAGE_EXT_IDLE,
@@ -36,6 +36,7 @@ struct page_ext { · 11 unmodified lines
3636 unsigned long flags;
3737 };
3838
39+extern unsigned long page_ext_size;
3940 extern void pgdat_page_ext_init(struct pglist_data *pgdat);
4041
4142 #ifdef CONFIG_SPARSEMEM
@@ -52,6 +53,13 @@ static inline void page_ext_init(void) · 10 unmodified lines
5253
5354 struct page_ext *lookup_page_ext(const struct page *page);
5455
56+static inline struct page_ext *page_ext_next(struct page_ext *curr)
57+{
58+ void *next = curr;
59+ next += page_ext_size;
60+ return next;
61+}
62+
5563 #else /* !CONFIG_PAGE_EXTENSION */
5664 struct page_ext;
5765
include/linux/phy.h+2−0
@@ -678,6 +678,7 @@ static inline bool phy_is_started(struct phy_device *phydev) · 677 unmodified lines
678678 return phydev->state >= PHY_UP;
679679 }
680680
681+void phy_resolve_aneg_pause(struct phy_device *phydev);
681682 void phy_resolve_aneg_linkmode(struct phy_device *phydev);
682683
683684 /**
@@ -1076,6 +1077,7 @@ int genphy_config_eee_advert(struct phy_device *phydev); · 392 unmodified lines
10761077 int __genphy_config_aneg(struct phy_device *phydev, bool changed);
10771078 int genphy_aneg_done(struct phy_device *phydev);
10781079 int genphy_update_link(struct phy_device *phydev);
1080+int genphy_read_lpa(struct phy_device *phydev);
10791081 int genphy_read_status(struct phy_device *phydev);
10801082 int genphy_suspend(struct phy_device *phydev);
10811083 int genphy_resume(struct phy_device *phydev);
include/linux/platform_device.h+2−0
@@ -64,6 +64,8 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, · 63 unmodified lines
6464 unsigned int,
6565 const char *);
6666 extern int platform_get_irq_byname(struct platform_device *, const char *);
67+extern int platform_get_irq_byname_optional(struct platform_device *dev,
68+ const char *name);
6769 extern int platform_add_devices(struct platform_device **, int);
6870
6971 struct platform_device_info {
include/linux/quotaops.h+3−1
@@ -97,7 +97,9 @@ int dquot_mark_dquot_dirty(struct dquot *dquot); · 96 unmodified lines
9797
9898 int dquot_file_open(struct inode *inode, struct file *file);
9999
100−int dquot_enable(struct inode *inode, int type, int format_id,
100+int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
101+ unsigned int flags);
102+int dquot_load_quota_inode(struct inode *inode, int type, int format_id,
101103 unsigned int flags);
102104 int dquot_quota_on(struct super_block *sb, int type, int format_id,
103105 const struct path *path);
include/linux/skbuff.h+1−4
@@ -4160,15 +4160,12 @@ static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {} · 4159 unmodified lines
41604160 static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {}
41614161 #endif /* CONFIG_SKB_EXTENSIONS */
41624162
4163−static inline void nf_reset(struct sk_buff *skb)
4163+static inline void nf_reset_ct(struct sk_buff *skb)
41644164 {
41654165 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
41664166 nf_conntrack_put(skb_nfct(skb));
41674167 skb->_nfct = 0;
41684168 #endif
4169−#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
4170− skb_ext_del(skb, SKB_EXT_BRIDGE_NF);
4171−#endif
41724169 }
41734170
41744171 static inline void nf_reset_trace(struct sk_buff *skb)
include/linux/slab.h+4−0
@@ -493,6 +493,10 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) · 492 unmodified lines
493493 * kmalloc is the normal method of allocating memory
494494 * for objects smaller than page size in the kernel.
495495 *
496+ * The allocated object address is aligned to at least ARCH_KMALLOC_MINALIGN
497+ * bytes. For @size of power of two bytes, the alignment is also guaranteed
498+ * to be at least to the size.
499+ *
496500 * The @flags argument may be one of the GFP flags defined at
497501 * include/linux/gfp.h and described at
498502 * :ref:`Documentation/core-api/mm-api.rst <mm-api-gfp-flags>`
include/linux/string.h+20−1
@@ -227,7 +227,26 @@ static inline bool strstarts(const char *str, const char *prefix) · 226 unmodified lines
227227 }
228228
229229 size_t memweight(const void *ptr, size_t bytes);
230−void memzero_explicit(void *s, size_t count);
230+
231+/**
232+ * memzero_explicit - Fill a region of memory (e.g. sensitive
233+ * keying data) with 0s.
234+ * @s: Pointer to the start of the area.
235+ * @count: The size of the area.
236+ *
237+ * Note: usually using memset() is just fine (!), but in cases
238+ * where clearing out _local_ data at the end of a scope is
239+ * necessary, memzero_explicit() should be used instead in
240+ * order to prevent the compiler from optimising away zeroing.
241+ *
242+ * memzero_explicit() doesn't need an arch-specific version as
243+ * it just invokes the one of memset() implicitly.
244+ */
245+static inline void memzero_explicit(void *s, size_t count)
246+{
247+ memset(s, 0, count);
248+ barrier_data(s);
249+}
231250
232251 /**
233252 * kbasename - return the last part of a pathname.
include/linux/sunrpc/xprtsock.h+1−0
@@ -61,6 +61,7 @@ struct sock_xprt { · 60 unmodified lines
6161 struct mutex recv_mutex;
6262 struct sockaddr_storage srcaddr;
6363 unsigned short srcport;
64+ int xprt_err;
6465
6566 /*
6667 * UDP socket buffer size parameters
include/linux/tpm_eventlog.h+12−4
@@ -152,7 +152,7 @@ struct tcg_algorithm_info { · 151 unmodified lines
152152 * total. Once we've done this we know the offset of the data length field,
153153 * and can calculate the total size of the event.
154154 *
155− * Return: size of the event on success, <0 on failure
155+ * Return: size of the event on success, 0 on failure
156156 */
157157
158158 static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event,
@@ -170,6 +170,7 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 11 unmodified lines
170170 u16 halg;
171171 int i;
172172 int j;
173+ u32 count, event_type;
173174
174175 marker = event;
175176 marker_start = marker;
@@ -190,16 +191,22 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 14 unmodified lines
190191 }
191192
192193 event = (struct tcg_pcr_event2_head *)mapping;
194+ /*
195+ * The loop below will unmap these fields if the log is larger than
196+ * one page, so save them here for reference:
197+ */
198+ count = READ_ONCE(event->count);
199+ event_type = READ_ONCE(event->event_type);
193200
194201 efispecid = (struct tcg_efi_specid_event_head *)event_header->event;
195202
196203 /* Check if event is malformed. */
197− if (event->count > efispecid->num_algs) {
204+ if (count > efispecid->num_algs) {
198205 size = 0;
199206 goto out;
200207 }
201208
202− for (i = 0; i < event->count; i++) {
209+ for (i = 0; i < count; i++) {
203210 halg_size = sizeof(event->digests[i].alg_id);
204211
205212 /* Map the digest's algorithm identifier */
@@ -256,8 +263,9 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 50 unmodified lines
256263 + event_field->event_size;
257264 size = marker - marker_start;
258265
259− if ((event->event_type == 0) && (event_field->event_size == 0))
266+ if (event_type == 0 && event_field->event_size == 0)
260267 size = 0;
268+
261269 out:
262270 if (do_mapping)
263271 TPM_MEMUNMAP(mapping, mapping_size);
include/linux/uaccess.h+74−2
@@ -231,6 +231,76 @@ __copy_from_user_inatomic_nocache(void *to, const void __user *from, · 230 unmodified lines
231231
232232 #endif /* ARCH_HAS_NOCACHE_UACCESS */
233233
234+extern __must_check int check_zeroed_user(const void __user *from, size_t size);
235+
236+/**
237+ * copy_struct_from_user: copy a struct from userspace
238+ * @dst: Destination address, in kernel space. This buffer must be @ksize
239+ * bytes long.
240+ * @ksize: Size of @dst struct.
241+ * @src: Source address, in userspace.
242+ * @usize: (Alleged) size of @src struct.
243+ *
244+ * Copies a struct from userspace to kernel space, in a way that guarantees
245+ * backwards-compatibility for struct syscall arguments (as long as future
246+ * struct extensions are made such that all new fields are *appended* to the
247+ * old struct, and zeroed-out new fields have the same meaning as the old
248+ * struct).
249+ *
250+ * @ksize is just sizeof(*dst), and @usize should've been passed by userspace.
251+ * The recommended usage is something like the following:
252+ *
253+ * SYSCALL_DEFINE2(foobar, const struct foo __user *, uarg, size_t, usize)
254+ * {
255+ * int err;
256+ * struct foo karg = {};
257+ *
258+ * if (usize > PAGE_SIZE)
259+ * return -E2BIG;
260+ * if (usize < FOO_SIZE_VER0)
261+ * return -EINVAL;
262+ *
263+ * err = copy_struct_from_user(&karg, sizeof(karg), uarg, usize);
264+ * if (err)
265+ * return err;
266+ *
267+ * // ...
268+ * }
269+ *
270+ * There are three cases to consider:
271+ * * If @usize == @ksize, then it's copied verbatim.
272+ * * If @usize < @ksize, then the userspace has passed an old struct to a
273+ * newer kernel. The rest of the trailing bytes in @dst (@ksize - @usize)
274+ * are to be zero-filled.
275+ * * If @usize > @ksize, then the userspace has passed a new struct to an
276+ * older kernel. The trailing bytes unknown to the kernel (@usize - @ksize)
277+ * are checked to ensure they are zeroed, otherwise -E2BIG is returned.
278+ *
279+ * Returns (in all cases, some data may have been copied):
280+ * * -E2BIG: (@usize > @ksize) and there are non-zero trailing bytes in @src.
281+ * * -EFAULT: access to userspace failed.
282+ */
283+static __always_inline __must_check int
284+copy_struct_from_user(void *dst, size_t ksize, const void __user *src,
285+ size_t usize)
286+{
287+ size_t size = min(ksize, usize);
288+ size_t rest = max(ksize, usize) - size;
289+
290+ /* Deal with trailing bytes. */
291+ if (usize < ksize) {
292+ memset(dst + size, 0, rest);
293+ } else if (usize > ksize) {
294+ int ret = check_zeroed_user(src + size, rest);
295+ if (ret <= 0)
296+ return ret ?: -E2BIG;
297+ }
298+ /* Copy the interoperable parts of the struct. */
299+ if (copy_from_user(dst, src, size))
300+ return -EFAULT;
301+ return 0;
302+}
303+
234304 /*
235305 * probe_kernel_read(): safely attempt to read from a location
236306 * @dst: pointer to the buffer that shall take the data
@@ -285,8 +355,10 @@ extern long strnlen_unsafe_user(const void __user *unsafe_addr, long count); · 48 unmodified lines
285355 #ifndef user_access_begin
286356 #define user_access_begin(ptr,len) access_ok(ptr, len)
287357 #define user_access_end() do { } while (0)
288−#define unsafe_get_user(x, ptr, err) do { if (unlikely(__get_user(x, ptr))) goto err; } while (0)
289−#define unsafe_put_user(x, ptr, err) do { if (unlikely(__put_user(x, ptr))) goto err; } while (0)
358+#define unsafe_op_wrap(op, err) do { if (unlikely(op)) goto err; } while (0)
359+#define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
360+#define unsafe_put_user(x,p,e) unsafe_op_wrap(__put_user(x,p),e)
361+#define unsafe_copy_to_user(d,s,l,e) unsafe_op_wrap(__copy_to_user(d,s,l),e)
290362 static inline unsigned long user_access_save(void) { return 0UL; }
291363 static inline void user_access_restore(unsigned long flags) { }
292364 #endif
include/linux/xarray.h+2−2
@@ -230,8 +230,8 @@ static inline int xa_err(void *entry) · 229 unmodified lines
230230 * This structure is used either directly or via the XA_LIMIT() macro
231231 * to communicate the range of IDs that are valid for allocation.
232232 * Two common ranges are predefined for you:
233− * * xa_limit_32b - [0 - UINT_MAX]
234− * * xa_limit_31b - [0 - INT_MAX]
233+ * * xa_limit_32b - [0 - UINT_MAX]
234+ * * xa_limit_31b - [0 - INT_MAX]
235235 */
236236 struct xa_limit {
237237 u32 max;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t