mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
virtio: regression fixes
Fixes two issues in the latest kernel. Signed-off-by: Michael S. Tsirkin <[email protected]> -----BEGIN PGP SIGNATURE----- iQEcBAABAgAGBQJaMs2CAAoJECgfDbjSjVRpUIgIAKxKE1Q/kK5ySNTCmbDUE5h7 XUtsKBqP9iwGaICVrlwcK0VZ6wq7ljwJIks9wBWRCu0AelbSm24VrbM5aZh8S6ij JOesH4qhTpeqeCD/IC16hTYEtg2FOElgYbnAPEOLlJihUvuJWn2xgXD6Ci2YXyKg waokN/7uTwB/i3tn67JZ2k5ICeaCYG4QhKzFy8cB3ktn1AcI3BD2iB/tzpzPBVQM SIh+OYytc4MUnDKaa5s6wVHfnBLuxn9j98K6NwTXZbyHsIcw5sFKid/2y2B0u2BE WUy4tYPJbzUGnQliuTKk2WQ1lo2XfiicgJ+BM2/7SEYJcqKFQd1j328UXID04sw= =yIX/ -----END PGP SIGNATURE----- Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost Pull virtio regression fixes from Michael Tsirkin: "Fixes two issues in the latest kernel" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: virtio_mmio: fix devm cleanup ptr_ring: fix up after recent ptr_ring changes
This commit is contained in:
commit
d6e47eed05
2 changed files with 32 additions and 40 deletions
|
|
@ -16,24 +16,41 @@
|
|||
#define unlikely(x) (__builtin_expect(!!(x), 0))
|
||||
#define likely(x) (__builtin_expect(!!(x), 1))
|
||||
#define ALIGN(x, a) (((x) + (a) - 1) / (a) * (a))
|
||||
#define SIZE_MAX (~(size_t)0)
|
||||
|
||||
typedef pthread_spinlock_t spinlock_t;
|
||||
|
||||
typedef int gfp_t;
|
||||
static void *kmalloc(unsigned size, gfp_t gfp)
|
||||
{
|
||||
return memalign(64, size);
|
||||
}
|
||||
#define __GFP_ZERO 0x1
|
||||
|
||||
static void *kzalloc(unsigned size, gfp_t gfp)
|
||||
static void *kmalloc(unsigned size, gfp_t gfp)
|
||||
{
|
||||
void *p = memalign(64, size);
|
||||
if (!p)
|
||||
return p;
|
||||
memset(p, 0, size);
|
||||
|
||||
if (gfp & __GFP_ZERO)
|
||||
memset(p, 0, size);
|
||||
return p;
|
||||
}
|
||||
|
||||
static inline void *kzalloc(unsigned size, gfp_t flags)
|
||||
{
|
||||
return kmalloc(size, flags | __GFP_ZERO);
|
||||
}
|
||||
|
||||
static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
|
||||
{
|
||||
if (size != 0 && n > SIZE_MAX / size)
|
||||
return NULL;
|
||||
return kmalloc(n * size, flags);
|
||||
}
|
||||
|
||||
static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
|
||||
{
|
||||
return kmalloc_array(n, size, flags | __GFP_ZERO);
|
||||
}
|
||||
|
||||
static void kfree(void *p)
|
||||
{
|
||||
if (p)
|
||||
|
|
|
|||
Loading…
Reference in a new issue