search for: nmemb

Displaying 20 results from an estimated 36 matches for "nmemb".

Did you mean: memb
2013 Sep 02
2
[PATCH] drm/nouveau: fix command submission to use vmalloc for big allocations
...u/drm/nouveau/nouveau_gem.c @@ -584,18 +584,34 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan, return 0; } +static inline void +u_free(void *addr) +{ + if (!is_vmalloc_addr(addr)) + kfree(addr); + else + vfree(addr); +} + static inline void * u_memcpya(uint64_t user, unsigned nmemb, unsigned size) { void *mem; void __user *userptr = (void __force __user *)(uintptr_t)user; - mem = kmalloc(nmemb * size, GFP_KERNEL); + if (nmemb > 256 * 1024 / size) + return ERR_PTR(-ENOMEM); + + size *= nmemb; + + mem = kmalloc(size, GFP_KERNEL | __GFP_NOWARN); + if (!mem) + mem = v...
2014 Feb 02
1
Trouble implementing ov_callbacks, endless loop calling seek_func
...func is being called endlessly. If the file is seekable, I should return 0, right? If any one can take a look at the following callback functions and see if they can spot what I'm doing wrong, it'd be much appreciated: size_t SourceFileImplOggVorbis::readFn( void *ptr, size_t size, size_t nmemb, void *datasource ) { auto sourceFile = (SourceFileImplOggVorbis *)datasource; size_t bytes = size * nmemb; sourceFile->mStream->readData( ptr, bytes ); return nmemb; } int SourceFileImplOggVorbis::seekFn( void *datasource, ogg_int64_t offset, int whence ) { auto sourceFile = (SourceFileIm...
2013 Sep 04
0
[PATCH] drm/nouveau: fix command submission to use vmalloc for big allocations
...; return 0; > } > > +static inline void > +u_free(void *addr) > +{ > + if (!is_vmalloc_addr(addr)) > + kfree(addr); > + else > + vfree(addr); > +} > + > static inline void * > u_memcpya(uint64_t user, unsigned nmemb, unsigned size) > { > void *mem; > void __user *userptr = (void __force __user *)(uintptr_t)user; > > - mem = kmalloc(nmemb * size, GFP_KERNEL); > + if (nmemb > 256 * 1024 / size) > + return ERR_PTR(-ENOMEM); > + > + siz...
2020 Aug 11
3
[PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
...tions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 81f111ad3f4f..7ef6221408af 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -587,15 +587,9 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) void __user *userptr = (void __force __user *)(uintptr_t)user; size *= nmemb; - - mem = kvmalloc(size, GFP_KERNEL); - if (!mem) - return ERR_PTR(-ENOMEM); - - if (copy_from_user(mem, userptr, size)) { - u_free(mem); - return ERR_PTR(-EFAULT); - } + mem = vmemdup_user(userptr...
2007 Mar 15
5
[PATCH 0/5] fix gcc warnings in CVS HEAD
Hi, I have rewritten the patches I submitted earlier today for the CVS HEAD. Some of the changes were already committed months ago. On 2007/03/15 12:30, Timo Sirainen <tss at iki.fi> wrote: > That's ok, but I'm not sure about bsearch_insert_pos(). It's the way it > is mostly because I wanted to keep bsearch() API. If it can't return > void * then maybe it could be
2023 Feb 22
1
[PATCH nbdkit] curl: Try to share as much as possible between handles in the pool
...de <nbdkit-plugin.h> +#include "array-size.h" #include "ascii-ctype.h" #include "ascii-string.h" #include "cleanup.h" @@ -73,6 +74,18 @@ static int debug_cb (CURL *handle, curl_infotype type, static size_t header_cb (void *ptr, size_t size, size_t nmemb, void *opaque); static size_t write_cb (char *ptr, size_t size, size_t nmemb, void *opaque); static size_t read_cb (void *ptr, size_t size, size_t nmemb, void *opaque); +static void lock_cb (CURL *handle, curl_lock_data data, + curl_lock_access access, void *userptr); +static...
2014 Feb 02
0
unsubscribe
...ing called endlessly. If the file is seekable, I should return 0, right? If any one can take a look at the following callback functions and see if they can spot what I'm doing wrong, it'd be much appreciated: > > size_t SourceFileImplOggVorbis::readFn( void *ptr, size_t size, size_t nmemb, void *datasource ) > { > auto sourceFile = (SourceFileImplOggVorbis *)datasource; > > size_t bytes = size * nmemb; > sourceFile->mStream->readData( ptr, bytes ); > > return nmemb; > } > > int SourceFileImplOggVorbis::seekFn( void *datasource, ogg_int64_t...
2020 Jul 25
0
[klibc:master] stdio: Define all the _unlocked functions and macros
...return _fwrite(s, strlen(s), file); } +__ALIAS(int, fputs_unlocked, (const char *, FILE *), fputs) diff --git a/usr/klibc/fread2.c b/usr/klibc/fread2.c index 7dca56b1..f5b2acb4 100644 --- a/usr/klibc/fread2.c +++ b/usr/klibc/fread2.c @@ -11,3 +11,4 @@ size_t fread(void *ptr, size_t size, size_t nmemb, FILE * f) { return _fread(ptr, size * nmemb, f) / size; } +__ALIAS(size_t, fread_unlocked, (void *, size_t, size_t, FILE *), fread) diff --git a/usr/klibc/fwrite2.c b/usr/klibc/fwrite2.c index cebc017c..a8c14c98 100644 --- a/usr/klibc/fwrite2.c +++ b/usr/klibc/fwrite2.c @@ -11,3 +11,5 @@ size_...
2016 May 08
3
x.with.overflow semantics question
Hi Pete, > Or do you mean that the result of an add may not even be defined? In that case would reading it be considered UB in the case where the overflow bit was set? Yeah, this is the case I'm worried about: that for example sadd.with.overflow(INT_MAX, 1) might be designed to return { poison, true } instead of giving a useful result in the first element of the struct. John
2023 Feb 22
2
[PATCH nbdkit] curl: Try to share as much as possible between handles in the pool
I'm mainly posting this to the list as a back-up. It does work, it does _not_ improve performance in any noticable way. However I'm having lots of trouble getting HTTP/2 to work (with or without this patch) and that's stopping me from testing anything properly. Rich.
2023 Feb 22
1
[PATCH nbdkit] curl: Try to share as much as possible between handles in the pool
...gt; +#include "array-size.h" > #include "ascii-ctype.h" > #include "ascii-string.h" > #include "cleanup.h" > @@ -73,6 +74,18 @@ static int debug_cb (CURL *handle, curl_infotype type, > static size_t header_cb (void *ptr, size_t size, size_t nmemb, void *opaque); > static size_t write_cb (char *ptr, size_t size, size_t nmemb, void *opaque); > static size_t read_cb (void *ptr, size_t size, size_t nmemb, void *opaque); > +static void lock_cb (CURL *handle, curl_lock_data data, > + curl_lock_access access, void...
2016 May 09
2
x.with.overflow semantics question
...(INT_MAX, 1) might be designed to return >> { poison, true } instead of giving a useful result in the first element of the struct. > > Any argument against that? I guess that would be the most natural definition given the motivation to have these > intrinsics (e.g., check if the 'nmemb * size' operation of calloc overflows; if so return null). > > InstCombine will remove these instrinsics if the overflow bit is unused, for example. AFAICT, InstCombine never adds > nsw/nuw to the replacements. I didn't check GVN. But I think they should unless there's some rea...
2020 Nov 12
0
[PATCH] drm/nouveau: Use vmemdup_user()
...d, 3 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 787d05e..df986d9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -591,14 +591,9 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) size *= nmemb; - mem = kvmalloc(size, GFP_KERNEL); - if (!mem) - return ERR_PTR(-ENOMEM); - - if (copy_from_user(mem, userptr, size)) { - u_free(mem); - return ERR_PTR(-EFAULT); - } + mem = vmemdup_user(userptr, size); + if (IS_ERR(mem)) + return ERR_CAST(mem); return...
2002 Mar 04
1
ov_open_callbacks
Hi` Is there some example code on how to use ov_open_callbacks with VorbisFile? The documentation I found is _very_ sparse and if possible I don't want to spend much time adding streaming from memory to my code. http://www.xiph.org/ogg/vorbis/doc/vorbisfile/ov_callbacks.html <p>Thanks, -- Daniel, Epic Games Inc. <p>--- >8 ---- List archives: http://www.xiph.org/archives/
2004 May 23
4
Various Ogg Vorbis largefile notes and/or patches
Greetings one and all; I'm not subscribed to this list so I'm first sending this message to verify that mails from me make it through, and then later I'll send the juicy messages with patches. Also, the address I'm using is IPv6-only and doesn't often work, so drop me from any replies and I'll catch the archives, or drop only the hostname part to get an IPv4 address that
2004 Aug 06
2
OGG123 frozen under certain circumstances while listening at icecast
...art_signal () from /lib/libpthread.so.0 #3 0x401eef0b in pthread_cond_wait@GLIBC_2.0 () from /lib/libpthread.so.0 #4 0x0804b0d3 in buffer_get_data (buf=0x8056d70, data=0x8082b70 "±ùñ`\004", nbytes=964) at buffer.c:542 #5 0x0804df6d in http_read (source=0x8055ab0, ptr=0x8080e00, size=1, nmemb=8500) at http_transport.c:280 #6 0x0804f5cd in vorbisfile_cb_read (ptr=0x8080e00, size=1, nmemb=8500, arg=0x8079658) at oggvorbis_format.c:259 #7 0x4001ccc8 in _get_next_page () from /usr/radio//lib/libvorbisfile.so.3 #8 0x4001d3be in _fetch_and_process_packet () from /usr/radio//lib/libvorbisfi...
2013 Nov 12
6
[PATCH 1/7] drm/nouveau: fix m2mf copy to tiled gart
From: Maarten Lankhorst <maarten.lankhorst at canonical.com> Commit de7b7d59d54852c introduced tiled GART, but a linear copy is still performed. This may result in errors on eviction, fix it by checking tiling from memtype. Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com> Cc: stable at vger.kernel.org #3.10+ --- drivers/gpu/drm/nouveau/nouveau_bo.c | 33
2019 Aug 21
2
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...et = validate_list(chan, cli, &op->list, pbbo, user_buffers); + ret = validate_list(chan, cli, &op->list, pbbo); if (unlikely(ret < 0)) { if (ret != -ERESTARTSYS) NV_PRINTK(err, cli, "validating bo list\n"); @@ -603,16 +596,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) static int nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, struct drm_nouveau_gem_pushbuf *req, + struct drm_nouveau_gem_pushbuf_reloc *reloc, struct drm_nouveau_gem_pushbuf_bo *bo) { - struct drm_nouveau_gem_pushbuf_reloc *reloc = NULL; int ret = 0; uns...
2019 Oct 21
1
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...et = validate_list(chan, cli, &op->list, pbbo, user_buffers); + ret = validate_list(chan, cli, &op->list, pbbo); if (unlikely(ret < 0)) { if (ret != -ERESTARTSYS) NV_PRINTK(err, cli, "validating bo list\n"); @@ -605,16 +598,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) static int nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, struct drm_nouveau_gem_pushbuf *req, + struct drm_nouveau_gem_pushbuf_reloc *reloc, struct drm_nouveau_gem_pushbuf_bo *bo) { - struct drm_nouveau_gem_pushbuf_reloc *reloc = NULL; int ret = 0; uns...
2019 Nov 04
2
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...et = validate_list(chan, cli, &op->list, pbbo, user_buffers); + ret = validate_list(chan, cli, &op->list, pbbo); if (unlikely(ret < 0)) { if (ret != -ERESTARTSYS) NV_PRINTK(err, cli, "validating bo list\n"); @@ -605,16 +598,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) static int nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, struct drm_nouveau_gem_pushbuf *req, + struct drm_nouveau_gem_pushbuf_reloc *reloc, struct drm_nouveau_gem_pushbuf_bo *bo) { - struct drm_nouveau_gem_pushbuf_reloc *reloc = NULL; int ret = 0; uns...