projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'linux-2.6' into for-2.6.22
[powerpc.git]
/
net
/
irda
/
irias_object.c
diff --git
a/net/irda/irias_object.c
b/net/irda/irias_object.c
index
b1ee99a
..
4adaae2
100644
(file)
--- a/
net/irda/irias_object.c
+++ b/
net/irda/irias_object.c
@@
-57,8
+57,8
@@
static char *strndup(char *str, size_t max)
len = max;
/* Allocate new string */
len = max;
/* Allocate new string */
-
new_str = kmalloc(len + 1, GFP_ATOMIC);
-
if (new_str == NULL) {
+ new_str = kmalloc(len + 1, GFP_ATOMIC);
+ if (new_str == NULL) {
IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL;
}
IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL;
}
@@
-78,7
+78,7
@@
static char *strndup(char *str, size_t max)
*/
struct ias_object *irias_new_object( char *name, int id)
{
*/
struct ias_object *irias_new_object( char *name, int id)
{
-
struct ias_object *obj;
+ struct ias_object *obj;
IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
@@
-91,6
+91,12
@@
struct ias_object *irias_new_object( char *name, int id)
obj->magic = IAS_OBJECT_MAGIC;
obj->name = strndup(name, IAS_MAX_CLASSNAME);
obj->magic = IAS_OBJECT_MAGIC;
obj->name = strndup(name, IAS_MAX_CLASSNAME);
+ if (!obj->name) {
+ IRDA_WARNING("%s(), Unable to allocate name!\n",
+ __FUNCTION__);
+ kfree(obj);
+ return NULL;
+ }
obj->id = id;
/* Locking notes : the attrib spinlock has lower precendence
obj->id = id;
/* Locking notes : the attrib spinlock has lower precendence
@@
-101,6
+107,7
@@
struct ias_object *irias_new_object( char *name, int id)
if (obj->attribs == NULL) {
IRDA_WARNING("%s(), Unable to allocate attribs!\n",
__FUNCTION__);
if (obj->attribs == NULL) {
IRDA_WARNING("%s(), Unable to allocate attribs!\n",
__FUNCTION__);
+ kfree(obj->name);
kfree(obj);
return NULL;
}
kfree(obj);
return NULL;
}
@@
-357,6
+364,15
@@
void irias_add_integer_attrib(struct ias_object *obj, char *name, int value,
/* Insert value */
attrib->value = irias_new_integer_value(value);
/* Insert value */
attrib->value = irias_new_integer_value(value);
+ if (!attrib->name || !attrib->value) {
+ IRDA_WARNING("%s: Unable to allocate attribute!\n",
+ __FUNCTION__);
+ if (attrib->value)
+ irias_delete_value(attrib->value);
+ kfree(attrib->name);
+ kfree(attrib);
+ return;
+ }
irias_add_attrib(obj, attrib, owner);
}
irias_add_attrib(obj, attrib, owner);
}
@@
-391,6
+407,15
@@
void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets,
attrib->name = strndup(name, IAS_MAX_ATTRIBNAME);
attrib->value = irias_new_octseq_value( octets, len);
attrib->name = strndup(name, IAS_MAX_ATTRIBNAME);
attrib->value = irias_new_octseq_value( octets, len);
+ if (!attrib->name || !attrib->value) {
+ IRDA_WARNING("%s: Unable to allocate attribute!\n",
+ __FUNCTION__);
+ if (attrib->value)
+ irias_delete_value(attrib->value);
+ kfree(attrib->name);
+ kfree(attrib);
+ return;
+ }
irias_add_attrib(obj, attrib, owner);
}
irias_add_attrib(obj, attrib, owner);
}
@@
-424,6
+449,15
@@
void irias_add_string_attrib(struct ias_object *obj, char *name, char *value,
attrib->name = strndup(name, IAS_MAX_ATTRIBNAME);
attrib->value = irias_new_string_value(value);
attrib->name = strndup(name, IAS_MAX_ATTRIBNAME);
attrib->value = irias_new_string_value(value);
+ if (!attrib->name || !attrib->value) {
+ IRDA_WARNING("%s: Unable to allocate attribute!\n",
+ __FUNCTION__);
+ if (attrib->value)
+ irias_delete_value(attrib->value);
+ kfree(attrib->name);
+ kfree(attrib);
+ return;
+ }
irias_add_attrib(obj, attrib, owner);
}
irias_add_attrib(obj, attrib, owner);
}
@@
-473,6
+507,12
@@
struct ias_value *irias_new_string_value(char *string)
value->type = IAS_STRING;
value->charset = CS_ASCII;
value->t.string = strndup(string, IAS_MAX_STRING);
value->type = IAS_STRING;
value->charset = CS_ASCII;
value->t.string = strndup(string, IAS_MAX_STRING);
+ if (!value->t.string) {
+ IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
+ kfree(value);
+ return NULL;
+ }
+
value->len = strlen(value->t.string);
return value;
value->len = strlen(value->t.string);
return value;