From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4723 invoked by alias); 27 Feb 2012 11:32:49 -0000 Received: (qmail 4706 invoked by uid 9737); 27 Feb 2012 11:32:48 -0000 Date: Mon, 27 Feb 2012 11:32:00 -0000 Message-ID: <20120227113248.4694.qmail@sourceware.org> From: zkabelac@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/lib/cache lvmetad.c Mailing-List: contact lvm2-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: lvm2-cvs-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00204.txt.bz2 CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-02-27 11:32:48 Modified files: lib/cache : lvmetad.c Log message: Check id_write_format result Currently we never fail with 64byte uuid buffer, but just stay consitent with rest of the code and check for result. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7 --- LVM2/lib/cache/lvmetad.c 2012/02/26 13:42:50 1.6 +++ LVM2/lib/cache/lvmetad.c 2012/02/27 11:32:48 1.7 @@ -153,7 +153,8 @@ return NULL; if (vgid) { - id_write_format((const struct id*)vgid, uuid, 64); + if (!id_write_format((const struct id*)vgid, uuid, sizeof(uuid))) + return_0; reply = daemon_send_simple(_lvmetad, "vg_lookup", "uuid = %s", uuid, NULL); } else { if (!vgname) @@ -293,7 +294,9 @@ if (!_using_lvmetad) return 1; /* just fake it */ - id_write_format(&vg->id, uuid, 64); + if (!id_write_format(&vg->id, uuid, sizeof(uuid))) + return_0; + reply = daemon_send_simple(_lvmetad, "vg_remove", "uuid = %s", uuid, NULL); return _lvmetad_handle_reply(reply, "remove VG", vg->name); @@ -309,7 +312,8 @@ if (!_using_lvmetad) return_0; - id_write_format(&pvid, uuid, 64); + if (!id_write_format(&pvid, uuid, sizeof(uuid))) + return_0; reply = daemon_send_simple(_lvmetad, "pv_lookup", "uuid = %s", uuid, NULL); @@ -482,7 +486,8 @@ if (!_using_lvmetad) return 1; - id_write_format(&pvid, uuid, 64); + if (!id_write_format(&pvid, uuid, sizeof(uuid))) + return_0; /* FIXME A more direct route would be much preferable. */ if ((info = lvmcache_info_from_pvid((const char *)&pvid, 0)))