Files
kernel_google_wahoo/include/linux/string.h
Petri Gynther 1c1a8fe37f Merge 4.4.175 into android-msm-wahoo-4.4-lts
Linux 4.4.175
  * uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define
      include/uapi/linux/if_ether.h
      include/uapi/linux/libc-compat.h
  * pinctrl: msm: fix gpio-hog related boot issues
      drivers/pinctrl/qcom/pinctrl-msm.c
    usb: dwc2: Remove unnecessary kfree
    kaweth: use skb_cow_head() to deal with cloned skbs
    ch9200: use skb_cow_head() to deal with cloned skbs
    smsc95xx: Use skb_cow_head to deal with cloned skbs
    dm thin: fix bug where bio that overwrites thin block ignores FUA
    x86/a.out: Clear the dump structure initially
  * signal: Restore the stop PTRACE_EVENT_EXIT
      kernel/signal.c
  * x86/platform/UV: Use efi_runtime_lock to serialise BIOS calls
      drivers/firmware/efi/runtime-wrappers.c
    tracing/uprobes: Fix output for multiple string arguments
    alpha: Fix Eiger NR_IRQS to 128
    alpha: fix page fault handling for r16-r18 targets
    Input: elantech - enable 3rd button support on Fujitsu CELSIUS H780
    Input: bma150 - register input device after setting private data
  * ALSA: usb-audio: Fix implicit fb endpoint setup by quirk
      sound/usb/pcm.c
    ALSA: hda - Add quirk for HP EliteBook 840 G5
  * perf/core: Fix impossible ring-buffer sizes warning
      kernel/events/ring_buffer.c
    Input: elan_i2c - add ACPI ID for touchpad in Lenovo V330-15ISK
    Revert "Input: elan_i2c - add ACPI ID for touchpad in ASUS Aspire F5-573G"
    Documentation/network: reword kernel version reference
    cifs: Limit memory used by lock request calls to a page
    gpio: pl061: handle failed allocations
    ARM: dts: kirkwood: Fix polarity of GPIO fan lines
    ARM: dts: da850-evm: Correct the sound card name
  * uapi/if_ether.h: prevent redefinition of struct ethhdr
      include/uapi/linux/if_ether.h
      include/uapi/linux/libc-compat.h
  * Revert "exec: load_script: don't blindly truncate shebang string"
      fs/binfmt_script.c
    batman-adv: Force mac header to start of data on xmit
    batman-adv: Avoid WARN on net_device without parent in netns
  * xfrm: refine validation of template and selector families
      net/xfrm/xfrm_user.c
    libceph: avoid KEEPALIVE_PENDING races in ceph_con_keepalive()
  * Revert "cifs: In Kconfig CONFIG_CIFS_POSIX needs depends on legacy (insecure cifs)"
      fs/cifs/Kconfig
    NFC: nxp-nci: Include unaligned.h instead of access_ok.h
  * HID: debug: fix the ring buffer implementation
      drivers/hid/hid-debug.c
      include/linux/hid-debug.h
    drm/vmwgfx: Return error code from vmw_execbuf_copy_fence_user
    drm/vmwgfx: Fix setting of dma masks
    drm/modes: Prevent division by zero htotal
    mac80211: ensure that mgmt tx skbs have tailroom for encryption
    ARM: iop32x/n2100: fix PCI IRQ mapping
    MIPS: VDSO: Include $(ccflags-vdso) in o32,n32 .lds builds
    MIPS: OCTEON: don't set octeon_dma_bar_type if PCI is disabled
    mips: cm: reprime error cause
  * debugfs: fix debugfs_rename parameter checking
      fs/debugfs/inode.c
    misc: vexpress: Off by one in vexpress_syscfg_exec()
  * signal: Better detection of synchronous signals
      kernel/signal.c
  * signal: Always notice exiting tasks
      kernel/signal.c
    mtd: rawnand: gpmi: fix MX28 bus master lockup problem
    perf tests evsel-tp-sched: Fix bitwise operator
  * perf/core: Don't WARN() for impossible ring-buffer sizes
      kernel/events/ring_buffer.c
    x86/MCE: Initialize mce.bank in the case of a fatal error in mce_no_way_out()
    perf/x86/intel/uncore: Add Node ID mask
    KVM: nVMX: unconditionally cancel preemption timer in free_nested (CVE-2019-7221)
    KVM: x86: work around leak of uninitialized stack contents (CVE-2019-7222)
    usb: gadget: udc: net2272: Fix bitwise and boolean operations
    usb: phy: am335x: fix race condition in _probe
    dmaengine: imx-dma: fix wrong callback invoke
  * fuse: handle zero sized retrieve correctly
      fs/fuse/dev.c
  * fuse: decrement NR_WRITEBACK_TEMP on the right page
      fs/fuse/file.c
  * fuse: call pipe_buf_release() under pipe lock
      fs/fuse/dev.c
    ALSA: hda - Serialize codec registrations
  * ALSA: compress: Fix stop handling on compressed capture streams
      include/sound/compress_driver.h
    net: dsa: slave: Don't propagate flag changes on down slave interfaces
    net: systemport: Fix WoL with password after deep sleep
    skge: potential memory corruption in skge_get_regs()
    net: dp83640: expire old TX-skb
    enic: fix checksum validation for IPv6
    dccp: fool proof ccid_hc_[rt]x_parse_options()
  * string: drop __must_check from strscpy() and restore strscpy() usages in cgroup
      include/linux/string.h
    tipc: use destination length for copy string
    test_hexdump: use memcpy instead of strncpy
  * thermal: hwmon: inline helpers when CONFIG_THERMAL_HWMON is not set
      drivers/thermal/thermal_hwmon.h
  * exec: load_script: don't blindly truncate shebang string
      fs/binfmt_script.c
  * fs/epoll: drop ovflist branch prediction
      fs/eventpoll.c
  * kernel/hung_task.c: break RCU locks based on jiffies
      kernel/hung_task.c
    HID: lenovo: Add checks to fix of_led_classdev_register
    block/swim3: Fix -EBUSY error when re-opening device after unmount
    gdrom: fix a memory leak bug
    isdn: hisax: hfc_pci: Fix a possible concurrency use-after-free bug in HFCPCI_l1hw()
    ocfs2: don't clear bh uptodate for block read
    scripts/decode_stacktrace: only strip base path when a prefix of the path
    niu: fix missing checks of niu_pci_eeprom_read
    um: Avoid marking pages with "changed protection"
    cifs: check ntwrk_buf_start for NULL before dereferencing it
    crypto: ux500 - Use proper enum in hash_set_dma_transfer
    crypto: ux500 - Use proper enum in cryp_set_dma_transfer
  * seq_buf: Make seq_buf_puts() null-terminate the buffer
      lib/seq_buf.c
    hwmon: (lm80) fix a missing check of bus read in lm80 probe
    hwmon: (lm80) fix a missing check of the status of SMBus read
    NFS: nfs_compare_mount_options always compare auth flavors.
    KVM: x86: svm: report MSR_IA32_MCG_EXT_CTL as unsupported
    fbdev: fbcon: Fix unregister crash when more than one framebuffer
    igb: Fix an issue that PME is not enabled during runtime suspend
  * fbdev: fbmem: behave better with small rotated displays and many CPUs
      drivers/video/fbdev/core/fbmem.c
    video: clps711x-fb: release disp device node in probe()
    drbd: Avoid Clang warning about pointless switch statment
    drbd: skip spurious timeout (ping-timeo) when failing promote
    drbd: disconnect, if the wrong UUIDs are attached on a connected peer
    drbd: narrow rcu_read_lock in drbd_sync_handshake
    cw1200: Fix concurrency use-after-free bugs in cw1200_hw_scan()
  * Bluetooth: Fix unnecessary error message for HCI request completion
      net/bluetooth/hci_event.c
  * xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi
      net/ipv6/xfrm6_tunnel.c
    mac80211: fix radiotap vendor presence bitmap handling
    powerpc/uaccess: fix warning/error with access_ok()
    arm64: KVM: Skip MMIO insn after emulation
    tty: serial: samsung: Properly set flags in autoCTS mode
    memstick: Prevent memstick host from getting runtime suspended during card detection
  * ASoC: fsl: Fix SND_SOC_EUKREA_TLV320 build error on i.MX8M
      sound/soc/fsl/Kconfig
    ARM: pxa: avoid section mismatch warning
    udf: Fix BUG on corrupted inode
    i2c-axxia: check for error conditions first
    cpuidle: big.LITTLE: fix refcount leak
    clk: imx6sl: ensure MMDC CH0 handshake is bypassed
    sata_rcar: fix deferred probing
    iommu/arm-smmu-v3: Use explicit mb() when moving cons pointer
    mips: bpf: fix encoding bug for mm_srlv32_op
    ARM: dts: Fix OMAP4430 SDP Ethernet startup
  * timekeeping: Use proper seqcount initializer
      kernel/time/timekeeping.c
  * usb: hub: delay hub autosuspend if USB3 port is still link training
      drivers/usb/core/hub.c
  * smack: fix access permissions for keyring
      security/smack/smack_lsm.c
    media: DaVinci-VPBE: fix error handling in vpbe_initialize()
    x86/fpu: Add might_fault() to user_insn()
    ARM: dts: mmp2: fix TWSI2
    arm64: ftrace: don't adjust the LR value
    nfsd4: fix crash on writing v4_end_grace before nfsd startup
    sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN
    f2fs: fix wrong return value of f2fs_acl_create
    f2fs: move dir data flush to write checkpoint process
    soc/tegra: Don't leak device tree node reference
    perf tools: Add Hygon Dhyana support
  * modpost: validate symbol names also in find_elf_symbol
      scripts/mod/modpost.c
    ARM: OMAP2+: hwmod: Fix some section annotations
    staging: iio: ad7780: update voltage on read
    staging:iio:ad2s90: Make probe handle spi_setup failure
    ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl
    serial: fsl_lpuart: clear parity enable bit when disable parity
    powerpc/pseries: add of_node_put() in dlpar_detach_node()
    x86/PCI: Fix Broadcom CNB20LE unintended sign extension (redux)
    dlm: Don't swamp the CPU with callbacks queued during recovery
    ARM: 8808/1: kexec:offline panic_smp_self_stop CPU
    scsi: lpfc: Correct LCB RJT handling
    ASoC: Intel: mrfld: fix uninitialized variable access
    staging: iio: adc: ad7280a: handle error from __ad7280_read32()
    drm/bufs: Fix Spectre v1 vulnerability

Change-Id: If064e7646cc87070a5c0a6b8f8b935cd93f5c88d
Signed-off-by: Petri Gynther <pgynther@google.com>
2019-02-22 14:47:05 -08:00

183 lines
5.2 KiB
C

#ifndef _LINUX_STRING_H_
#define _LINUX_STRING_H_
#include <linux/compiler.h> /* for inline */
#include <linux/types.h> /* for size_t */
#include <linux/stddef.h> /* for NULL */
#include <stdarg.h>
#include <uapi/linux/string.h>
extern char *strndup_user(const char __user *, long);
extern void *memdup_user(const void __user *, size_t);
/*
* Include machine specific inline routines
*/
#include <asm/string.h>
#ifndef __HAVE_ARCH_STRCPY
extern char * strcpy(char *,const char *);
#endif
#ifndef __HAVE_ARCH_STRNCPY
extern char * strncpy(char *,const char *, __kernel_size_t);
#endif
#ifndef __HAVE_ARCH_STRLCPY
size_t strlcpy(char *, const char *, size_t);
#endif
#ifndef __HAVE_ARCH_STRSCPY
ssize_t strscpy(char *, const char *, size_t);
#endif
#ifndef __HAVE_ARCH_STRCAT
extern char * strcat(char *, const char *);
#endif
#ifndef __HAVE_ARCH_STRNCAT
extern char * strncat(char *, const char *, __kernel_size_t);
#endif
#ifndef __HAVE_ARCH_STRLCAT
extern size_t strlcat(char *, const char *, __kernel_size_t);
#endif
#ifndef __HAVE_ARCH_STRCMP
extern int strcmp(const char *,const char *);
#endif
#ifndef __HAVE_ARCH_STRNCMP
extern int strncmp(const char *,const char *,__kernel_size_t);
#endif
#ifndef __HAVE_ARCH_STRCASECMP
extern int strcasecmp(const char *s1, const char *s2);
#endif
#ifndef __HAVE_ARCH_STRNCASECMP
extern int strncasecmp(const char *s1, const char *s2, size_t n);
#endif
#ifndef __HAVE_ARCH_STRCHR
extern char * strchr(const char *,int);
#endif
#ifndef __HAVE_ARCH_STRCHRNUL
extern char * strchrnul(const char *,int);
#endif
#ifndef __HAVE_ARCH_STRNCHR
extern char * strnchr(const char *, size_t, int);
#endif
#ifndef __HAVE_ARCH_STRRCHR
extern char * strrchr(const char *,int);
#endif
extern char * __must_check skip_spaces(const char *);
extern char *strim(char *);
static inline __must_check char *strstrip(char *str)
{
return strim(str);
}
#ifndef __HAVE_ARCH_STRSTR
extern char * strstr(const char *, const char *);
#endif
#ifndef __HAVE_ARCH_STRNSTR
extern char * strnstr(const char *, const char *, size_t);
#endif
#ifndef __HAVE_ARCH_STRLEN
extern __kernel_size_t strlen(const char *);
#endif
#ifndef __HAVE_ARCH_STRNLEN
extern __kernel_size_t strnlen(const char *,__kernel_size_t);
#endif
#ifndef __HAVE_ARCH_STRPBRK
extern char * strpbrk(const char *,const char *);
#endif
#ifndef __HAVE_ARCH_STRSEP
extern char * strsep(char **,const char *);
#endif
#ifndef __HAVE_ARCH_STRSPN
extern __kernel_size_t strspn(const char *,const char *);
#endif
#ifndef __HAVE_ARCH_STRCSPN
extern __kernel_size_t strcspn(const char *,const char *);
#endif
#ifndef __HAVE_ARCH_MEMSET
extern void * memset(void *,int,__kernel_size_t);
#endif
#ifndef __HAVE_ARCH_MEMCPY
extern void * memcpy(void *,const void *,__kernel_size_t);
#endif
#ifndef __HAVE_ARCH_MEMMOVE
extern void * memmove(void *,const void *,__kernel_size_t);
#endif
#ifndef __HAVE_ARCH_MEMSCAN
extern void * memscan(void *,int,__kernel_size_t);
#endif
#ifndef __HAVE_ARCH_MEMCMP
extern int memcmp(const void *,const void *,__kernel_size_t);
#endif
#ifndef __HAVE_ARCH_MEMCHR
extern void * memchr(const void *,int,__kernel_size_t);
#endif
void *memchr_inv(const void *s, int c, size_t n);
char *strreplace(char *s, char old, char new);
extern void kfree_const(const void *x);
extern char *kstrdup(const char *s, gfp_t gfp);
extern const char *kstrdup_const(const char *s, gfp_t gfp);
extern char *kstrndup(const char *s, size_t len, gfp_t gfp);
extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp);
extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
extern void argv_free(char **argv);
extern bool sysfs_streq(const char *s1, const char *s2);
extern int kstrtobool(const char *s, bool *res);
static inline int strtobool(const char *s, bool *res)
{
return kstrtobool(s, res);
}
int match_string(const char * const *array, size_t n, const char *string);
int __sysfs_match_string(const char * const *array, size_t n, const char *s);
/**
* sysfs_match_string - matches given string in an array
* @_a: array of strings
* @_s: string to match with
*
* Helper for __sysfs_match_string(). Calculates the size of @a automatically.
*/
#define sysfs_match_string(_a, _s) __sysfs_match_string(_a, ARRAY_SIZE(_a), _s)
#ifdef CONFIG_BINARY_PRINTF
int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args);
int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf);
int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4);
#endif
extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
const void *from, size_t available);
/**
* strstarts - does @str start with @prefix?
* @str: string to examine
* @prefix: prefix to look for.
*/
static inline bool strstarts(const char *str, const char *prefix)
{
return strncmp(str, prefix, strlen(prefix)) == 0;
}
size_t memweight(const void *ptr, size_t bytes);
void memzero_explicit(void *s, size_t count);
/**
* kbasename - return the last part of a pathname.
*
* @path: path to extract the filename from.
*/
static inline const char *kbasename(const char *path)
{
const char *tail = strrchr(path, '/');
return tail ? tail + 1 : path;
}
#endif /* _LINUX_STRING_H_ */