snprintf is never going to return a negative value, and it will always put a NULL character at the end of the string. See lib/vsprintf.c::vsnprintf(). --- diff/drivers/md/dm-io.c 2004-02-27 11:10:41.000000000 +0000 +++ source/drivers/md/dm-io.c 2004-03-01 11:49:42.000000000 +0000 @@ -58,11 +58,7 @@ static void bio_set_exit(struct bio_set static void mk_name(char *str, size_t len, const char *prefix, unsigned count) { - int r; - - r = snprintf(str, len, "%s-%u", prefix, count); - if (r < 0) - str[len - 1] = '\0'; + snprintf(str, len, "%s-%u", prefix, count); } static int bio_set_init(struct bio_set *bs, const char *slab_prefix, @@ -75,7 +71,6 @@ static int bio_set_init(struct bio_set * }; - int r; unsigned i, size; struct biovec_pool *bp; @@ -85,9 +80,7 @@ static int bio_set_init(struct bio_set * /* * Set up the bio pool. */ - r = snprintf(bs->name, sizeof(bs->name), "%s-bio", slab_prefix); - if (r < 0) - bs->name[sizeof(bs->name) - 1] = '\0'; + snprintf(bs->name, sizeof(bs->name), "%s-bio", slab_prefix); bs->bio_slab = kmem_cache_create(bs->name, sizeof(struct bio), 0, SLAB_HWCACHE_ALIGN, NULL, NULL);