tree: https://github.com/ceph/ceph-client.git testing head: e88127f37eb54d6bf273a671e0355233644d3539 commit: c300156bc734796e251fa31b07dff2af2f572889 [7/40] rbd: pass rbd_spec into parse_rbd_opts_token() reproduce: # apt-get install sparse git checkout c300156bc734796e251fa31b07dff2af2f572889 make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) include/linux/slab.h:631:13: sparse: undefined identifier '__builtin_mul_overflow' drivers/block/rbd.c:1269:9: sparse: expression using sizeof(void) drivers/block/rbd.c:1269:9: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) drivers/block/rbd.c:1270:9: sparse: expression using sizeof(void) drivers/block/rbd.c:1270:9: sparse: expression using sizeof(void) drivers/block/rbd.c:1270:9: sparse: expression using sizeof(void) drivers/block/rbd.c:1270:9: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) drivers/block/rbd.c:1280:9: sparse: expression using sizeof(void) drivers/block/rbd.c:1280:9: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/slab.h:631:13: sparse: not a function <noident> drivers/block/rbd.c:2102:9: sparse: expression using sizeof(void) drivers/block/rbd.c:2102:9: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) drivers/block/rbd.c:2112:9: sparse: expression using sizeof(void) drivers/block/rbd.c:2112:9: sparse: expression using sizeof(void) drivers/block/rbd.c:2112:9: sparse: expression using sizeof(void) drivers/block/rbd.c:2112:9: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) drivers/block/rbd.c:2125:9: sparse: expression using sizeof(void) drivers/block/rbd.c:2125:9: sparse: expression using sizeof(void) drivers/block/rbd.c:2125:9: sparse: expression using sizeof(void) drivers/block/rbd.c:2125:9: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) drivers/block/rbd.c:2174:9: sparse: expression using sizeof(void) drivers/block/rbd.c:2174:9: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) drivers/block/rbd.c:2185:9: sparse: expression using sizeof(void) drivers/block/rbd.c:2185:9: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) drivers/block/rbd.c:2336:9: sparse: expression using sizeof(void) drivers/block/rbd.c:2336:9: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:82:37: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/bvec.h:83:32: sparse: expression using sizeof(void) include/linux/slab.h:631:13: sparse: not a function <noident> >> drivers/block/rbd.c:5154:44: sparse: Using plain integer as NULL pointer include/linux/slab.h:631:13: sparse: call with no type! vim +5154 drivers/block/rbd.c 5102 5103 /* 5104 * Parse the options provided for an "rbd add" (i.e., rbd image 5105 * mapping) request. These arrive via a write to /sys/bus/rbd/add, 5106 * and the data written is passed here via a NUL-terminated buffer. 5107 * Returns 0 if successful or an error code otherwise. 5108 * 5109 * The information extracted from these options is recorded in 5110 * the other parameters which return dynamically-allocated 5111 * structures: 5112 * ceph_opts 5113 * The address of a pointer that will refer to a ceph options 5114 * structure. Caller must release the returned pointer using 5115 * ceph_destroy_options() when it is no longer needed. 5116 * rbd_opts 5117 * Address of an rbd options pointer. Fully initialized by 5118 * this function; caller must release with kfree(). 5119 * spec 5120 * Address of an rbd image specification pointer. Fully 5121 * initialized by this function based on parsed options. 5122 * Caller must release with rbd_spec_put(). 5123 * 5124 * The options passed take this form: 5125 * <mon_addrs> <options> <pool_name> <image_name> [<snap_id>] 5126 * where: 5127 * <mon_addrs> 5128 * A comma-separated list of one or more monitor addresses. 5129 * A monitor address is an ip address, optionally followed 5130 * by a port number (separated by a colon). 5131 * I.e.: ip1[:port1][,ip2[:port2]...] 5132 * <options> 5133 * A comma-separated list of ceph and/or rbd options. 5134 * <pool_name> 5135 * The name of the rados pool containing the rbd image. 5136 * <image_name> 5137 * The name of the image in that pool to map. 5138 * <snap_id> 5139 * An optional snapshot id. If provided, the mapping will 5140 * present data from the image at the time that snapshot was 5141 * created. The image head is used if no snapshot id is 5142 * provided. Snapshot mappings are always read-only. 5143 */ 5144 static int rbd_add_parse_args(const char *buf, 5145 struct ceph_options **ceph_opts, 5146 struct rbd_options **opts, 5147 struct rbd_spec **rbd_spec) 5148 { 5149 size_t len; 5150 char *options; 5151 const char *mon_addrs; 5152 char *snap_name; 5153 size_t mon_addrs_size; > 5154 struct parse_rbd_opts_ctx pctx = { 0 }; 5155 struct ceph_options *copts; 5156 int ret; 5157 5158 /* The first four tokens are required */ 5159 5160 len = next_token(&buf); 5161 if (!len) { 5162 rbd_warn(NULL, "no monitor address(es) provided"); 5163 return -EINVAL; 5164 } 5165 mon_addrs = buf; 5166 mon_addrs_size = len + 1; 5167 buf += len; 5168 5169 ret = -EINVAL; 5170 options = dup_token(&buf, NULL); 5171 if (!options) 5172 return -ENOMEM; 5173 if (!*options) { 5174 rbd_warn(NULL, "no options provided"); 5175 goto out_err; 5176 } 5177 5178 pctx.spec = rbd_spec_alloc(); 5179 if (!pctx.spec) 5180 goto out_mem; 5181 5182 pctx.spec->pool_name = dup_token(&buf, NULL); 5183 if (!pctx.spec->pool_name) 5184 goto out_mem; 5185 if (!*pctx.spec->pool_name) { 5186 rbd_warn(NULL, "no pool name provided"); 5187 goto out_err; 5188 } 5189 5190 pctx.spec->image_name = dup_token(&buf, NULL); 5191 if (!pctx.spec->image_name) 5192 goto out_mem; 5193 if (!*pctx.spec->image_name) { 5194 rbd_warn(NULL, "no image name provided"); 5195 goto out_err; 5196 } 5197 5198 /* 5199 * Snapshot name is optional; default is to use "-" 5200 * (indicating the head/no snapshot). 5201 */ 5202 len = next_token(&buf); 5203 if (!len) { 5204 buf = RBD_SNAP_HEAD_NAME; /* No snapshot supplied */ 5205 len = sizeof (RBD_SNAP_HEAD_NAME) - 1; 5206 } else if (len > RBD_MAX_SNAP_NAME_LEN) { 5207 ret = -ENAMETOOLONG; 5208 goto out_err; 5209 } 5210 snap_name = kmemdup(buf, len + 1, GFP_KERNEL); 5211 if (!snap_name) 5212 goto out_mem; 5213 *(snap_name + len) = '\0'; 5214 pctx.spec->snap_name = snap_name; 5215 5216 /* Initialize all rbd options to the defaults */ 5217 5218 pctx.opts = kzalloc(sizeof(*pctx.opts), GFP_KERNEL); 5219 if (!pctx.opts) 5220 goto out_mem; 5221 5222 pctx.opts->read_only = RBD_READ_ONLY_DEFAULT; 5223 pctx.opts->queue_depth = RBD_QUEUE_DEPTH_DEFAULT; 5224 pctx.opts->lock_timeout = RBD_LOCK_TIMEOUT_DEFAULT; 5225 pctx.opts->lock_on_read = RBD_LOCK_ON_READ_DEFAULT; 5226 pctx.opts->exclusive = RBD_EXCLUSIVE_DEFAULT; 5227 pctx.opts->trim = RBD_TRIM_DEFAULT; 5228 5229 copts = ceph_parse_options(options, mon_addrs, 5230 mon_addrs + mon_addrs_size - 1, 5231 parse_rbd_opts_token, &pctx); 5232 if (IS_ERR(copts)) { 5233 ret = PTR_ERR(copts); 5234 goto out_err; 5235 } 5236 kfree(options); 5237 5238 *ceph_opts = copts; 5239 *opts = pctx.opts; 5240 *rbd_spec = pctx.spec; 5241 5242 return 0; 5243 out_mem: 5244 ret = -ENOMEM; 5245 out_err: 5246 kfree(pctx.opts); 5247 rbd_spec_put(pctx.spec); 5248 kfree(options); 5249 5250 return ret; 5251 } 5252 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html