Displaying 20 results from an estimated 37 matches for "nlen".
Did you mean:
len
2007 Jan 05
1
[PATCH] Re: [Xen-staging] [xen-unstable] [XEN] Avoid use of GNU-specific memmem().
...> --- a/xen/tools/symbols.c Wed Jan 03 23:53:27 2007 +0000
> +++ b/xen/tools/symbols.c Thu Jan 04 10:17:34 2007 +0000
> @@ -350,6 +350,14 @@ static void build_initial_tok_table(void
> table_cnt = pos;
> }
>
> +static void *memmem_pvt(void *h, size_t hlen, void *n, size_t nlen)
> +{
> + char *p;
> + for (p = h; (p - (char *)h) <= (hlen - nlen); p++)
> + if (!memcmp(p, n, nlen)) return p;
> + return NULL;
> +}
size_t is unsigned, (hlen - nlen) can wrap and cause a segfault. The
patch below fixes it. Thanks,
Alex
Signed-off-by: Alex Williamso...
2004 Feb 25
5
Wide strings and LPCTSTR types
All,
I was experimenting with converting LPCTSTR strings to wide strings with
something like this:
// Converts a Ruby string to a LPWSTR
LPCTSTR AllocWideLString(VALUE rbString){
char* str = STR2CSTR(rbString);
int length = (strlen(str)+1) * sizeof(WCHAR);
LPCTSTR lpStr = (LPCTSTR)malloc(length);
MultiByteToWideChar(
CP_ACP,
0,
str,
strlen(str)+1,
2024 Feb 20
2
[PATCH] [v4] nouveau: add command-line GSP-RM registry support
...oid an O(n) calculation of the size when the RPC is built.
+ *
+ * Returns 0 on success, or negative error code on error.
+ */
+static int add_registry(struct nvkm_gsp *gsp, const char *key,
+ enum registry_type type, const void *data, size_t length)
+{
+ struct registry_list_entry *reg;
+ size_t nlen = strlen(key) + 1;
+ size_t vlen; /* value length, non-zero if binary or string */
+
+ /* Set an arbitrary limit to avoid problems with broken command lines */
+ if (nlen > 64)
+ return -EFBIG;
+
+ vlen = (type == REGISTRY_TABLE_ENTRY_TYPE_DWORD) ? 0 : length;
+
+ reg = kmalloc(sizeof(struct re...
2013 May 22
1
column width in .dbf files using write.dbf ... to be continued
...as.character(x)
else as.integer(x)
else if (inherits(x, "Date"))
dataframe[[i]] <- format(x, "%Y%m%d")
}
precision <- integer(m)
scale <- integer(m)
dfnames <- names(dataframe)
for (i in seq_len(m)) {
nlen <- nchar(dfnames[i], "b")
x <- dataframe[, i]
if (is.logical(x)) {
precision[i] <- 1L
scale[i] <- 0L
}
else if (is.integer(x)) {
rx <- range(x, na.rm = TRUE)
rx[!is.finite(rx)] <- 0...
2001 Mar 04
1
bubblebabble patch
...Sun Mar 4 00:48:41 2001
+++ ./openssh-2.5.1/key.c Sun Mar 4 01:07:21 2001
@@ -153,6 +153,179 @@
return 0;
}
+u_char*
+key_fingerprint_raw(Key *k, enum digest_type dgst_type, size_t
*dgst_raw_length)
+{
+ u_char *blob = NULL;
+ u_char* retval = NULL;
+ int len = 0;
+ int nlen, elen;
+
+ switch (k->type) {
+ case KEY_RSA1:
+ nlen = BN_num_bytes(k->rsa->n);
+ elen = BN_num_bytes(k->rsa->e);
+ len = nlen + elen;
+ blob = xmalloc(len);
+ BN_bn2bin(k->rsa->n, blob);...
2018 Sep 26
2
[PATCH 4/4] drm/virtio: Use IDAs more efficiently
On Wed, Sep 26, 2018 at 09:00:31AM -0700, Matthew Wilcox wrote:
> @@ -59,6 +59,7 @@ static int virtio_gpu_context_create(struct virtio_gpu_device *vgdev,
>
> if (handle < 0)
> return handle;
> + handle++;
> virtio_gpu_cmd_context_create(vgdev, handle, nlen, name);
> return handle;
> }
Uh. This line is missing.
- int handle = ida_alloc_min(&vgdev->ctx_id_ida, 1, GFP_KERNEL);
+ int handle = ida_alloc(&vgdev->ctx_id_ida, GFP_KERNEL);
It'll be there in v2 ;-)
2018 Sep 26
2
[PATCH 4/4] drm/virtio: Use IDAs more efficiently
On Wed, Sep 26, 2018 at 09:00:31AM -0700, Matthew Wilcox wrote:
> @@ -59,6 +59,7 @@ static int virtio_gpu_context_create(struct virtio_gpu_device *vgdev,
>
> if (handle < 0)
> return handle;
> + handle++;
> virtio_gpu_cmd_context_create(vgdev, handle, nlen, name);
> return handle;
> }
Uh. This line is missing.
- int handle = ida_alloc_min(&vgdev->ctx_id_ida, 1, GFP_KERNEL);
+ int handle = ida_alloc(&vgdev->ctx_id_ida, GFP_KERNEL);
It'll be there in v2 ;-)
2018 Sep 26
5
[PATCH 0/4] Improve virtio ID allocation
I noticed you were using IDRs where you could be using the more efficient
IDAs, then while fixing that I noticed the lack of error handling,
and I decided to follow that up with an efficiency improvement.
There's probably a v2 of this to follow because I couldn't figure
out how to properly handle one of the error cases ... see the comment
embedded in one of the patches.
Matthew Wilcox
2024 Jan 29
0
[PATCH] [v2] nouveau: add command-line GSP-RM registry support
...keys.
+ * It's used to avoid an O(n) calculation of the size when the RPC is built.
+ *
+ * Returns 0 on success, or negative error code on error.
+ */
+static int add_registry(struct nvkm_gsp *gsp, const char *name, u32 type, u32 data, u32 length)
+{
+ struct registry_list_entry *reg;
+ size_t nlen = strlen(name) + 1;
+
+ /* Set an arbitrary limit to avoid problems with broken command lines */
+ if (strlen(name) > 64)
+ return -EFBIG;
+
+ reg = kmalloc(sizeof(struct registry_list_entry) + nlen, GFP_KERNEL);
+ if (!reg)
+ return -ENOMEM;
+
+ memcpy(reg->name, name, nlen);
+ reg->nam...
2010 Jan 13
1
column width in .dbf files using write.dbf ... to be continued
...as.character(x)
else as.integer(x)
else if (inherits(x, "Date"))
dataframe[[i]] <- format(x, "%Y%m%d")
}
precision <- integer(m)
scale <- integer(m)
dfnames <- names(dataframe)
for (i in seq_len(m)) {
nlen <- nchar(dfnames[i], "b")
x <- dataframe[, i]
if (is.logical(x)) {
precision[i] <- 1L
scale[i] <- 0L
}
else if (is.integer(x)) {
rx <- range(x, na.rm = TRUE)
rx[!is.finite(rx)] <- 0...
2024 Mar 20
1
[PATCH] [v4] nouveau: add command-line GSP-RM registry support
...urns 0 on success, or negative error code on error.
> > + */
> > +static int add_registry(struct nvkm_gsp *gsp, const char *key,
> > + enum registry_type type, const void *data,
> > size_t length)
> > +{
> > + struct registry_list_entry *reg;
> > + size_t nlen = strlen(key) + 1;
> > + size_t vlen; /* value length, non-zero if binary or string */
> > +
> > + /* Set an arbitrary limit to avoid problems with broken command
> > lines */
> > + if (nlen > 64)
> > + return -EFBIG;
> > +
> > + vlen = (type == R...
2015 Sep 21
2
[PATCH v2 4/6] virtio-gpu: add 3d/virgl support
...et_info(struct virtio_gpu_device *vgdev, int idx);
+int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev,
+ int idx, int version,
+ struct virtio_gpu_drv_cap_cache **cache_p);
+void virtio_gpu_cmd_context_create(struct virtio_gpu_device *vgdev, uint32_t id,
+ uint32_t nlen, const char *name);
+void virtio_gpu_cmd_context_destroy(struct virtio_gpu_device *vgdev,
+ uint32_t id);
+void virtio_gpu_cmd_context_attach_resource(struct virtio_gpu_device *vgdev,
+ uint32_t ctx_id,
+ uint32_t resource_id);
+void virtio_gpu_cmd_context_detach_resource(str...
2015 Sep 21
2
[PATCH v2 4/6] virtio-gpu: add 3d/virgl support
...et_info(struct virtio_gpu_device *vgdev, int idx);
+int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev,
+ int idx, int version,
+ struct virtio_gpu_drv_cap_cache **cache_p);
+void virtio_gpu_cmd_context_create(struct virtio_gpu_device *vgdev, uint32_t id,
+ uint32_t nlen, const char *name);
+void virtio_gpu_cmd_context_destroy(struct virtio_gpu_device *vgdev,
+ uint32_t id);
+void virtio_gpu_cmd_context_attach_resource(struct virtio_gpu_device *vgdev,
+ uint32_t ctx_id,
+ uint32_t resource_id);
+void virtio_gpu_cmd_context_detach_resource(str...
2018 Sep 13
0
[PATCH 3/3] drm/virtio: add edid support
...pu_cmd_get_capset(struct virtio_gpu_device *vgdev,
int idx, int version,
struct virtio_gpu_drv_cap_cache **cache_p);
+int virtio_gpu_cmd_get_edids(struct virtio_gpu_device *vgdev);
void virtio_gpu_cmd_context_create(struct virtio_gpu_device *vgdev, uint32_t id,
uint32_t nlen, const char *name);
void virtio_gpu_cmd_context_destroy(struct virtio_gpu_device *vgdev,
diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index 25503b9335..e573eab1f1 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/...
2015 Oct 02
0
[PATCH v3 4/7] virtio-gpu: add 3d/virgl support
...et_info(struct virtio_gpu_device *vgdev, int idx);
+int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev,
+ int idx, int version,
+ struct virtio_gpu_drv_cap_cache **cache_p);
+void virtio_gpu_cmd_context_create(struct virtio_gpu_device *vgdev, uint32_t id,
+ uint32_t nlen, const char *name);
+void virtio_gpu_cmd_context_destroy(struct virtio_gpu_device *vgdev,
+ uint32_t id);
+void virtio_gpu_cmd_context_attach_resource(struct virtio_gpu_device *vgdev,
+ uint32_t ctx_id,
+ uint32_t resource_id);
+void virtio_gpu_cmd_context_detach_resource(str...
2015 Oct 02
0
[PATCH v3 4/7] virtio-gpu: add 3d/virgl support
...et_info(struct virtio_gpu_device *vgdev, int idx);
+int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev,
+ int idx, int version,
+ struct virtio_gpu_drv_cap_cache **cache_p);
+void virtio_gpu_cmd_context_create(struct virtio_gpu_device *vgdev, uint32_t id,
+ uint32_t nlen, const char *name);
+void virtio_gpu_cmd_context_destroy(struct virtio_gpu_device *vgdev,
+ uint32_t id);
+void virtio_gpu_cmd_context_attach_resource(struct virtio_gpu_device *vgdev,
+ uint32_t ctx_id,
+ uint32_t resource_id);
+void virtio_gpu_cmd_context_detach_resource(str...
2015 Sep 21
0
[PATCH v2 4/6] virtio-gpu: add 3d/virgl support
..._device *vgdev, int idx);
> +int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev,
> + int idx, int version,
> + struct virtio_gpu_drv_cap_cache **cache_p);
> +void virtio_gpu_cmd_context_create(struct virtio_gpu_device *vgdev, uint32_t id,
> + uint32_t nlen, const char *name);
> +void virtio_gpu_cmd_context_destroy(struct virtio_gpu_device *vgdev,
> + uint32_t id);
> +void virtio_gpu_cmd_context_attach_resource(struct virtio_gpu_device *vgdev,
> + uint32_t ctx_id,
> + uint32_t resource_id);
> +void virtio_gpu_c...
2015 Sep 09
3
[PATCH 3/5] update virtio gpu driver: add 3d/virgl support
...et_info(struct virtio_gpu_device *vgdev, int idx);
+int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev,
+ int idx, int version,
+ struct virtio_gpu_drv_cap_cache **cache_p);
+void virtio_gpu_cmd_context_create(struct virtio_gpu_device *vgdev, uint32_t id,
+ uint32_t nlen, const char *name);
+void virtio_gpu_cmd_context_destroy(struct virtio_gpu_device *vgdev,
+ uint32_t id);
+void virtio_gpu_cmd_context_attach_resource(struct virtio_gpu_device *vgdev,
+ uint32_t ctx_id,
+ uint32_t resource_id);
+void virtio_gpu_cmd_context_detach_resource(str...
2015 Sep 09
3
[PATCH 3/5] update virtio gpu driver: add 3d/virgl support
...et_info(struct virtio_gpu_device *vgdev, int idx);
+int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev,
+ int idx, int version,
+ struct virtio_gpu_drv_cap_cache **cache_p);
+void virtio_gpu_cmd_context_create(struct virtio_gpu_device *vgdev, uint32_t id,
+ uint32_t nlen, const char *name);
+void virtio_gpu_cmd_context_destroy(struct virtio_gpu_device *vgdev,
+ uint32_t id);
+void virtio_gpu_cmd_context_attach_resource(struct virtio_gpu_device *vgdev,
+ uint32_t ctx_id,
+ uint32_t resource_id);
+void virtio_gpu_cmd_context_detach_resource(str...
2000 Jan 27
1
Long awaited round 1 of NeXT patches.
...nd misc-source repository. I believe it comes
+ * from Thomas Funke <thf at zelator.in-berlin.de>. Includes
+ * some mods from Garance Drosehn <gad at eclipse.its.rpi.edu>.
+ */
+#if !defined(HAVE_SETENV) && !defined(HAVE_PUTENV)
+int putenv(char *s)
+{
+ int nlen;
+ char *cptr;
+ char **nenv, **eptr;
+ extern char **environ;
+
+ /* first see if there is any environment setup. If not,
+ * create it with this single variable in it.
+ */
+ if (environ == NULL) {
+ nenv = (char **) malloc(2 * sizeof(char *));
+ if (nenv == NULL)
+ return...