From patchwork Fri Mar 18 19:50:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bmarzins@sourceware.org X-Patchwork-Id: 644751 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2IJrQNm028686 for ; Fri, 18 Mar 2011 19:53:48 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2IJosQB031363; Fri, 18 Mar 2011 15:50:55 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2IJoqkV028679 for ; Fri, 18 Mar 2011 15:50:52 -0400 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2IJol8X015392 for ; Fri, 18 Mar 2011 15:50:47 -0400 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by mx1.redhat.com (8.14.4/8.14.4) with SMTP id p2IJogGn027401 for ; Fri, 18 Mar 2011 15:50:42 -0400 Received: (qmail 15640 invoked by uid 9475); 18 Mar 2011 19:50:42 -0000 Date: 18 Mar 2011 19:50:42 -0000 Message-ID: <20110318195042.15638.qmail@sourceware.org> From: bmarzins@sourceware.org To: dm-cvs@sourceware.org, dm-devel@redhat.com X-RedHat-Spam-Score: -2.31 (RCVD_IN_DNSWL_MED,T_RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Subject: [dm-devel] multipath-tools libmultipath/dict.c libmultipa ... X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 18 Mar 2011 19:53:49 +0000 (UTC) --- multipath-tools/libmultipath/dict.c 2011/02/18 18:27:00 1.17.2.17 +++ multipath-tools/libmultipath/dict.c 2011/03/18 19:50:40 1.17.2.18 @@ -27,10 +27,13 @@ { char * buff; - buff = VECTOR_SLOT(strvec, 1); + buff = set_value(strvec); + if (!buff) + return 1; conf->checkint = atoi(buff); conf->max_checkint = MAX_CHECKINT(conf->checkint); + FREE(buff); return 0; } @@ -40,6 +43,8 @@ char * buff; buff = set_value(strvec); + if (!buff) + return 1; if (strlen(buff) == 3 && !strcmp(buff, "off")) conf->fast_io_fail = -1; else if (sscanf(buff, "%d", &conf->fast_io_fail) != 1 || @@ -56,6 +61,8 @@ char * buff; buff = set_value(strvec); + if (!buff) + return 1; if (sscanf(buff, "%u", &conf->dev_loss) != 1) conf->dev_loss = 0; @@ -68,9 +75,12 @@ { char * buff; - buff = VECTOR_SLOT(strvec, 1); + buff = set_value(strvec); + if (!buff) + return 1; conf->verbosity = atoi(buff); + FREE(buff); return 0; } @@ -306,6 +316,8 @@ char * buff; buff = set_value(strvec); + if (!buff) + return 1; if (strlen(buff) == 6 && !strcmp(buff, "manual")) conf->pgfailback = -FAILBACK_MANUAL; @@ -729,6 +741,8 @@ struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); buff = set_value(strvec); + if (!buff) + return 1; if (strlen(buff) == 3 && !strcmp(buff, "off")) hwe->fast_io_fail = -1; else if (sscanf(buff, "%d", &hwe->fast_io_fail) != 1 || @@ -746,6 +760,8 @@ struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); buff = set_value(strvec); + if (!buff) + return 1; if (sscanf(buff, "%u", &hwe->dev_loss) != 1) hwe->dev_loss = 0; @@ -883,7 +899,8 @@ return 1; buff = set_value(strvec); - + if (!buff) + return 1; if (strlen(buff) == 6 && !strcmp(buff, "manual")) hwe->pgfailback = -FAILBACK_MANUAL; else if (strlen(buff) == 9 && !strcmp(buff, "immediate")) @@ -1155,7 +1172,8 @@ return 1; buff = set_value(strvec); - + if (!buff) + return 1; if (strlen(buff) == 6 && !strcmp(buff, "manual")) mpe->pgfailback = -FAILBACK_MANUAL; else if (strlen(buff) == 9 && !strcmp(buff, "immediate")) --- multipath-tools/libmultipath/parser.c 2011/03/07 05:19:38 1.18.2.3 +++ multipath-tools/libmultipath/parser.c 2011/03/18 19:50:40 1.18.2.4 @@ -2,7 +2,7 @@ * Part: Configuration file parser/reader. Place into the dynamic * data structure representation the conf file * - * Version: $Id: parser.c,v 1.18.2.3 2011/03/07 05:19:38 bmarzins Exp $ + * Version: $Id: parser.c,v 1.18.2.4 2011/03/18 19:50:40 bmarzins Exp $ * * Author: Alexandre Cassen, * @@ -374,13 +374,17 @@ void * set_value(vector strvec) { - char *str = VECTOR_SLOT(strvec, 1); - int size = strlen(str); + char *str; + int size; int i = 0; int len = 0; char *alloc = NULL; char *tmp; + if (VECTOR_SIZE(strvec) < 2) + return NULL; + str = VECTOR_SLOT(strvec, 1); + size = strlen(str); if (*str == '"') { for (i = 2; i < VECTOR_SIZE(strvec); i++) { str = VECTOR_SLOT(strvec, i); --- multipath-tools/multipath/multipath.conf.redhat 2008/01/15 01:34:36 1.6.2.7 +++ multipath-tools/multipath/multipath.conf.redhat 2011/03/18 19:50:41 1.6.2.8 @@ -36,7 +36,7 @@ # selector "round-robin 0" # path_grouping_policy multibus # getuid_callout "/sbin/scsi_id -g -u -s /block/%n" -# prio_callout /bin/true +# prio_callout none # path_checker readsector0 # rr_min_io 100 # max_fds 8192