aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2010-05-24 17:33:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-25 11:07:02 -0400
commit4be929be34f9bdeffa40d815d32d7d60d2c7f03b (patch)
tree4d2c6e2b8ef766e565e2e050ee151de2e02081d3
parent940370fc86b920b51a34217a1facc3e9e97c2456 (diff)
kernel-wide: replace USHORT_MAX, SHORT_MAX and SHORT_MIN with USHRT_MAX, SHRT_MAX and SHRT_MIN
- C99 knows about USHRT_MAX/SHRT_MAX/SHRT_MIN, not USHORT_MAX/SHORT_MAX/SHORT_MIN. - Make SHRT_MIN of type s16, not int, for consistency. [akpm@linux-foundation.org: fix drivers/dma/timb_dma.c] [akpm@linux-foundation.org: fix security/keys/keyring.c] Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Acked-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/dma/timb_dma.c2
-rw-r--r--drivers/scsi/fcoe/fcoe.c2
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c2
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_config.c2
-rw-r--r--drivers/vhost/vhost.c2
-rw-r--r--fs/nfs/super.c4
-rw-r--r--fs/nfsd/nfsctl.c4
-rw-r--r--fs/ocfs2/blockcheck.c4
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/sched.h2
-rw-r--r--include/net/ip.h6
-rw-r--r--include/net/ipv6.h6
-rw-r--r--ipc/msg.c12
-rw-r--r--ipc/util.c4
-rw-r--r--lib/vsprintf.c2
-rw-r--r--net/9p/protocol.c2
-rw-r--r--net/dccp/options.c2
-rw-r--r--net/ipv4/udp.c8
-rw-r--r--net/mac80211/sta_info.c2
-rw-r--r--net/sunrpc/rpcb_clnt.c2
-rw-r--r--security/keys/keyring.c6
21 files changed, 41 insertions, 41 deletions
diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c
index 0172fa3c7a2b..a1bf77c1993f 100644
--- a/drivers/dma/timb_dma.c
+++ b/drivers/dma/timb_dma.c
@@ -188,7 +188,7 @@ static void __td_unmap_descs(struct timb_dma_desc *td_desc, bool single)
188static int td_fill_desc(struct timb_dma_chan *td_chan, u8 *dma_desc, 188static int td_fill_desc(struct timb_dma_chan *td_chan, u8 *dma_desc,
189 struct scatterlist *sg, bool last) 189 struct scatterlist *sg, bool last)
190{ 190{
191 if (sg_dma_len(sg) > USHORT_MAX) { 191 if (sg_dma_len(sg) > USHRT_MAX) {
192 dev_err(chan2dev(&td_chan->chan), "Too big sg element\n"); 192 dev_err(chan2dev(&td_chan->chan), "Too big sg element\n");
193 return -EINVAL; 193 return -EINVAL;
194 } 194 }
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 9276121db1ef..44a07593de56 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -688,7 +688,7 @@ static int fcoe_shost_config(struct fc_lport *lport, struct device *dev)
688 } 688 }
689 689
690 if (!lport->vport) 690 if (!lport->vport)
691 fc_host_max_npiv_vports(lport->host) = USHORT_MAX; 691 fc_host_max_npiv_vports(lport->host) = USHRT_MAX;
692 692
693 snprintf(fc_host_symbolic_name(lport->host), FC_SYMBOLIC_NAME_SIZE, 693 snprintf(fc_host_symbolic_name(lport->host), FC_SYMBOLIC_NAME_SIZE,
694 "%s v%s over %s", FCOE_NAME, FCOE_VERSION, 694 "%s v%s over %s", FCOE_NAME, FCOE_VERSION,
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index b830d61684dd..0ec1ed389c20 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -3757,7 +3757,7 @@ _base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase)
3757 if (ioc->config_cmds.status & MPT2_CMD_PENDING) { 3757 if (ioc->config_cmds.status & MPT2_CMD_PENDING) {
3758 ioc->config_cmds.status |= MPT2_CMD_RESET; 3758 ioc->config_cmds.status |= MPT2_CMD_RESET;
3759 mpt2sas_base_free_smid(ioc, ioc->config_cmds.smid); 3759 mpt2sas_base_free_smid(ioc, ioc->config_cmds.smid);
3760 ioc->config_cmds.smid = USHORT_MAX; 3760 ioc->config_cmds.smid = USHRT_MAX;
3761 complete(&ioc->config_cmds.done); 3761 complete(&ioc->config_cmds.done);
3762 } 3762 }
3763 break; 3763 break;
diff --git a/drivers/scsi/mpt2sas/mpt2sas_config.c b/drivers/scsi/mpt2sas/mpt2sas_config.c
index e762dd3e2fcb..c65442982d7b 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_config.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_config.c
@@ -258,7 +258,7 @@ mpt2sas_config_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
258#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 258#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
259 _config_display_some_debug(ioc, smid, "config_done", mpi_reply); 259 _config_display_some_debug(ioc, smid, "config_done", mpi_reply);
260#endif 260#endif
261 ioc->config_cmds.smid = USHORT_MAX; 261 ioc->config_cmds.smid = USHRT_MAX;
262 complete(&ioc->config_cmds.done); 262 complete(&ioc->config_cmds.done);
263 return 1; 263 return 1;
264} 264}
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 750effe0f98b..c6fb8e968f21 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -806,7 +806,7 @@ static unsigned get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
806 count = indirect->len / sizeof desc; 806 count = indirect->len / sizeof desc;
807 /* Buffers are chained via a 16 bit next field, so 807 /* Buffers are chained via a 16 bit next field, so
808 * we can have at most 2^16 of these. */ 808 * we can have at most 2^16 of these. */
809 if (count > USHORT_MAX + 1) { 809 if (count > USHRT_MAX + 1) {
810 vq_err(vq, "Indirect buffer length too big: %d\n", 810 vq_err(vq, "Indirect buffer length too big: %d\n",
811 indirect->len); 811 indirect->len);
812 return -E2BIG; 812 return -E2BIG;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 2f8b1157daa2..04214fc5c304 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1060,7 +1060,7 @@ static int nfs_parse_mount_options(char *raw,
1060 goto out_nomem; 1060 goto out_nomem;
1061 rc = strict_strtoul(string, 10, &option); 1061 rc = strict_strtoul(string, 10, &option);
1062 kfree(string); 1062 kfree(string);
1063 if (rc != 0 || option > USHORT_MAX) 1063 if (rc != 0 || option > USHRT_MAX)
1064 goto out_invalid_value; 1064 goto out_invalid_value;
1065 mnt->nfs_server.port = option; 1065 mnt->nfs_server.port = option;
1066 break; 1066 break;
@@ -1181,7 +1181,7 @@ static int nfs_parse_mount_options(char *raw,
1181 goto out_nomem; 1181 goto out_nomem;
1182 rc = strict_strtoul(string, 10, &option); 1182 rc = strict_strtoul(string, 10, &option);
1183 kfree(string); 1183 kfree(string);
1184 if (rc != 0 || option > USHORT_MAX) 1184 if (rc != 0 || option > USHRT_MAX)
1185 goto out_invalid_value; 1185 goto out_invalid_value;
1186 mnt->mount_server.port = option; 1186 mnt->mount_server.port = option;
1187 break; 1187 break;
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index bc3194ea01f5..508941c23af7 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -998,7 +998,7 @@ static ssize_t __write_ports_addxprt(char *buf)
998 if (sscanf(buf, "%15s %4u", transport, &port) != 2) 998 if (sscanf(buf, "%15s %4u", transport, &port) != 2)
999 return -EINVAL; 999 return -EINVAL;
1000 1000
1001 if (port < 1 || port > USHORT_MAX) 1001 if (port < 1 || port > USHRT_MAX)
1002 return -EINVAL; 1002 return -EINVAL;
1003 1003
1004 err = nfsd_create_serv(); 1004 err = nfsd_create_serv();
@@ -1040,7 +1040,7 @@ static ssize_t __write_ports_delxprt(char *buf)
1040 if (sscanf(&buf[1], "%15s %4u", transport, &port) != 2) 1040 if (sscanf(&buf[1], "%15s %4u", transport, &port) != 2)
1041 return -EINVAL; 1041 return -EINVAL;
1042 1042
1043 if (port < 1 || port > USHORT_MAX || nfsd_serv == NULL) 1043 if (port < 1 || port > USHRT_MAX || nfsd_serv == NULL)
1044 return -EINVAL; 1044 return -EINVAL;
1045 1045
1046 xprt = svc_find_xprt(nfsd_serv, transport, AF_UNSPEC, port); 1046 xprt = svc_find_xprt(nfsd_serv, transport, AF_UNSPEC, port);
diff --git a/fs/ocfs2/blockcheck.c b/fs/ocfs2/blockcheck.c
index b7428c5d0d3b..ec6d12339593 100644
--- a/fs/ocfs2/blockcheck.c
+++ b/fs/ocfs2/blockcheck.c
@@ -403,7 +403,7 @@ void ocfs2_block_check_compute(void *data, size_t blocksize,
403 * No ecc'd ocfs2 structure is larger than 4K, so ecc will be no 403 * No ecc'd ocfs2 structure is larger than 4K, so ecc will be no
404 * larger than 16 bits. 404 * larger than 16 bits.
405 */ 405 */
406 BUG_ON(ecc > USHORT_MAX); 406 BUG_ON(ecc > USHRT_MAX);
407 407
408 bc->bc_crc32e = cpu_to_le32(crc); 408 bc->bc_crc32e = cpu_to_le32(crc);
409 bc->bc_ecc = cpu_to_le16((u16)ecc); 409 bc->bc_ecc = cpu_to_le16((u16)ecc);
@@ -508,7 +508,7 @@ void ocfs2_block_check_compute_bhs(struct buffer_head **bhs, int nr,
508 * No ecc'd ocfs2 structure is larger than 4K, so ecc will be no 508 * No ecc'd ocfs2 structure is larger than 4K, so ecc will be no
509 * larger than 16 bits. 509 * larger than 16 bits.
510 */ 510 */
511 BUG_ON(ecc > USHORT_MAX); 511 BUG_ON(ecc > USHRT_MAX);
512 512
513 bc->bc_crc32e = cpu_to_le32(crc); 513 bc->bc_crc32e = cpu_to_le32(crc);
514 bc->bc_ecc = cpu_to_le16((u16)ecc); 514 bc->bc_ecc = cpu_to_le16((u16)ecc);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index cc5e3ffe9fce..a2e7c32e17e7 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -24,9 +24,9 @@
24extern const char linux_banner[]; 24extern const char linux_banner[];
25extern const char linux_proc_banner[]; 25extern const char linux_proc_banner[];
26 26
27#define USHORT_MAX ((u16)(~0U)) 27#define USHRT_MAX ((u16)(~0U))
28#define SHORT_MAX ((s16)(USHORT_MAX>>1)) 28#define SHRT_MAX ((s16)(USHRT_MAX>>1))
29#define SHORT_MIN (-SHORT_MAX - 1) 29#define SHRT_MIN ((s16)(-SHRT_MAX - 1))
30#define INT_MAX ((int)(~0U>>1)) 30#define INT_MAX ((int)(~0U>>1))
31#define INT_MIN (-INT_MAX - 1) 31#define INT_MIN (-INT_MAX - 1)
32#define UINT_MAX (~0U) 32#define UINT_MAX (~0U)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 415b8f8a3f45..c0151ffd3541 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -384,7 +384,7 @@ struct user_namespace;
384 * 1-3 now and depends on arch. We use "5" as safe margin, here. 384 * 1-3 now and depends on arch. We use "5" as safe margin, here.
385 */ 385 */
386#define MAPCOUNT_ELF_CORE_MARGIN (5) 386#define MAPCOUNT_ELF_CORE_MARGIN (5)
387#define DEFAULT_MAX_MAP_COUNT (USHORT_MAX - MAPCOUNT_ELF_CORE_MARGIN) 387#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
388 388
389extern int sysctl_max_map_count; 389extern int sysctl_max_map_count;
390 390
diff --git a/include/net/ip.h b/include/net/ip.h
index 63548f0a44b1..452f229c380a 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -358,11 +358,11 @@ enum ip_defrag_users {
358 IP_DEFRAG_LOCAL_DELIVER, 358 IP_DEFRAG_LOCAL_DELIVER,
359 IP_DEFRAG_CALL_RA_CHAIN, 359 IP_DEFRAG_CALL_RA_CHAIN,
360 IP_DEFRAG_CONNTRACK_IN, 360 IP_DEFRAG_CONNTRACK_IN,
361 __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHORT_MAX, 361 __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHRT_MAX,
362 IP_DEFRAG_CONNTRACK_OUT, 362 IP_DEFRAG_CONNTRACK_OUT,
363 __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHORT_MAX, 363 __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHRT_MAX,
364 IP_DEFRAG_CONNTRACK_BRIDGE_IN, 364 IP_DEFRAG_CONNTRACK_BRIDGE_IN,
365 __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX, 365 __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHRT_MAX,
366 IP_DEFRAG_VS_IN, 366 IP_DEFRAG_VS_IN,
367 IP_DEFRAG_VS_OUT, 367 IP_DEFRAG_VS_OUT,
368 IP_DEFRAG_VS_FWD 368 IP_DEFRAG_VS_FWD
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index eba5cc00325a..2600b69757b8 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -354,11 +354,11 @@ struct inet_frag_queue;
354enum ip6_defrag_users { 354enum ip6_defrag_users {
355 IP6_DEFRAG_LOCAL_DELIVER, 355 IP6_DEFRAG_LOCAL_DELIVER,
356 IP6_DEFRAG_CONNTRACK_IN, 356 IP6_DEFRAG_CONNTRACK_IN,
357 __IP6_DEFRAG_CONNTRACK_IN = IP6_DEFRAG_CONNTRACK_IN + USHORT_MAX, 357 __IP6_DEFRAG_CONNTRACK_IN = IP6_DEFRAG_CONNTRACK_IN + USHRT_MAX,
358 IP6_DEFRAG_CONNTRACK_OUT, 358 IP6_DEFRAG_CONNTRACK_OUT,
359 __IP6_DEFRAG_CONNTRACK_OUT = IP6_DEFRAG_CONNTRACK_OUT + USHORT_MAX, 359 __IP6_DEFRAG_CONNTRACK_OUT = IP6_DEFRAG_CONNTRACK_OUT + USHRT_MAX,
360 IP6_DEFRAG_CONNTRACK_BRIDGE_IN, 360 IP6_DEFRAG_CONNTRACK_BRIDGE_IN,
361 __IP6_DEFRAG_CONNTRACK_BRIDGE_IN = IP6_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX, 361 __IP6_DEFRAG_CONNTRACK_BRIDGE_IN = IP6_DEFRAG_CONNTRACK_BRIDGE_IN + USHRT_MAX,
362}; 362};
363 363
364struct ip6_create_arg { 364struct ip6_create_arg {
diff --git a/ipc/msg.c b/ipc/msg.c
index 9547cb7ac313..747b65507a91 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -345,19 +345,19 @@ copy_msqid_to_user(void __user *buf, struct msqid64_ds *in, int version)
345 out.msg_rtime = in->msg_rtime; 345 out.msg_rtime = in->msg_rtime;
346 out.msg_ctime = in->msg_ctime; 346 out.msg_ctime = in->msg_ctime;
347 347
348 if (in->msg_cbytes > USHORT_MAX) 348 if (in->msg_cbytes > USHRT_MAX)
349 out.msg_cbytes = USHORT_MAX; 349 out.msg_cbytes = USHRT_MAX;
350 else 350 else
351 out.msg_cbytes = in->msg_cbytes; 351 out.msg_cbytes = in->msg_cbytes;
352 out.msg_lcbytes = in->msg_cbytes; 352 out.msg_lcbytes = in->msg_cbytes;
353 353
354 if (in->msg_qnum > USHORT_MAX) 354 if (in->msg_qnum > USHRT_MAX)
355 out.msg_qnum = USHORT_MAX; 355 out.msg_qnum = USHRT_MAX;
356 else 356 else
357 out.msg_qnum = in->msg_qnum; 357 out.msg_qnum = in->msg_qnum;
358 358
359 if (in->msg_qbytes > USHORT_MAX) 359 if (in->msg_qbytes > USHRT_MAX)
360 out.msg_qbytes = USHORT_MAX; 360 out.msg_qbytes = USHRT_MAX;
361 else 361 else
362 out.msg_qbytes = in->msg_qbytes; 362 out.msg_qbytes = in->msg_qbytes;
363 out.msg_lqbytes = in->msg_qbytes; 363 out.msg_lqbytes = in->msg_qbytes;
diff --git a/ipc/util.c b/ipc/util.c
index 79ce84e890f7..69a0cc13d966 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -124,8 +124,8 @@ void ipc_init_ids(struct ipc_ids *ids)
124 ids->seq = 0; 124 ids->seq = 0;
125 { 125 {
126 int seq_limit = INT_MAX/SEQ_MULTIPLIER; 126 int seq_limit = INT_MAX/SEQ_MULTIPLIER;
127 if (seq_limit > USHORT_MAX) 127 if (seq_limit > USHRT_MAX)
128 ids->seq_max = USHORT_MAX; 128 ids->seq_max = USHRT_MAX;
129 else 129 else
130 ids->seq_max = seq_limit; 130 ids->seq_max = seq_limit;
131 } 131 }
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 46d34b0b74a8..20c95121d8a1 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1980,7 +1980,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
1980 { 1980 {
1981 char *s = (char *)va_arg(args, char *); 1981 char *s = (char *)va_arg(args, char *);
1982 if (field_width == -1) 1982 if (field_width == -1)
1983 field_width = SHORT_MAX; 1983 field_width = SHRT_MAX;
1984 /* first, skip leading white space in buffer */ 1984 /* first, skip leading white space in buffer */
1985 str = skip_spaces(str); 1985 str = skip_spaces(str);
1986 1986
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 77d3aab4036b..149f82160130 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -394,7 +394,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
394 const char *sptr = va_arg(ap, const char *); 394 const char *sptr = va_arg(ap, const char *);
395 int16_t len = 0; 395 int16_t len = 0;
396 if (sptr) 396 if (sptr)
397 len = MIN(strlen(sptr), USHORT_MAX); 397 len = MIN(strlen(sptr), USHRT_MAX);
398 398
399 errcode = p9pdu_writef(pdu, proto_version, 399 errcode = p9pdu_writef(pdu, proto_version,
400 "w", len); 400 "w", len);
diff --git a/net/dccp/options.c b/net/dccp/options.c
index 1b08cae9c65b..07395f861d35 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -296,7 +296,7 @@ static inline u8 dccp_ndp_len(const u64 ndp)
296{ 296{
297 if (likely(ndp <= 0xFF)) 297 if (likely(ndp <= 0xFF))
298 return 1; 298 return 1;
299 return likely(ndp <= USHORT_MAX) ? 2 : (ndp <= UINT_MAX ? 4 : 6); 299 return likely(ndp <= USHRT_MAX) ? 2 : (ndp <= UINT_MAX ? 4 : 6);
300} 300}
301 301
302int dccp_insert_option(struct sock *sk, struct sk_buff *skb, 302int dccp_insert_option(struct sock *sk, struct sk_buff *skb,
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 9de6a698f91d..baeec29fe0f1 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1686,8 +1686,8 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
1686 return -ENOPROTOOPT; 1686 return -ENOPROTOOPT;
1687 if (val != 0 && val < 8) /* Illegal coverage: use default (8) */ 1687 if (val != 0 && val < 8) /* Illegal coverage: use default (8) */
1688 val = 8; 1688 val = 8;
1689 else if (val > USHORT_MAX) 1689 else if (val > USHRT_MAX)
1690 val = USHORT_MAX; 1690 val = USHRT_MAX;
1691 up->pcslen = val; 1691 up->pcslen = val;
1692 up->pcflag |= UDPLITE_SEND_CC; 1692 up->pcflag |= UDPLITE_SEND_CC;
1693 break; 1693 break;
@@ -1700,8 +1700,8 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
1700 return -ENOPROTOOPT; 1700 return -ENOPROTOOPT;
1701 if (val != 0 && val < 8) /* Avoid silly minimal values. */ 1701 if (val != 0 && val < 8) /* Avoid silly minimal values. */
1702 val = 8; 1702 val = 8;
1703 else if (val > USHORT_MAX) 1703 else if (val > USHRT_MAX)
1704 val = USHORT_MAX; 1704 val = USHRT_MAX;
1705 up->pcrlen = val; 1705 up->pcrlen = val;
1706 up->pcflag |= UDPLITE_RECV_CC; 1706 up->pcflag |= UDPLITE_RECV_CC;
1707 break; 1707 break;
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 730197591ab5..ba9360a475b0 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -259,7 +259,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
259 skb_queue_head_init(&sta->tx_filtered); 259 skb_queue_head_init(&sta->tx_filtered);
260 260
261 for (i = 0; i < NUM_RX_DATA_QUEUES; i++) 261 for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
262 sta->last_seq_ctrl[i] = cpu_to_le16(USHORT_MAX); 262 sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX);
263 263
264#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 264#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
265 printk(KERN_DEBUG "%s: Allocated STA %pM\n", 265 printk(KERN_DEBUG "%s: Allocated STA %pM\n",
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 121105355f60..dac219a56ae1 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -783,7 +783,7 @@ static int rpcb_dec_getport(struct rpc_rqst *req, __be32 *p,
783 port = ntohl(*p); 783 port = ntohl(*p);
784 dprintk("RPC: %5u PMAP_%s result: %lu\n", task->tk_pid, 784 dprintk("RPC: %5u PMAP_%s result: %lu\n", task->tk_pid,
785 task->tk_msg.rpc_proc->p_name, port); 785 task->tk_msg.rpc_proc->p_name, port);
786 if (unlikely(port > USHORT_MAX)) 786 if (unlikely(port > USHRT_MAX))
787 return -EIO; 787 return -EIO;
788 788
789 rpcb->r_port = port; 789 rpcb->r_port = port;
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index ef03a82a0135..d37f713e73ce 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -669,7 +669,7 @@ static void keyring_unlink_rcu_disposal(struct rcu_head *rcu)
669 struct keyring_list *klist = 669 struct keyring_list *klist =
670 container_of(rcu, struct keyring_list, rcu); 670 container_of(rcu, struct keyring_list, rcu);
671 671
672 if (klist->delkey != USHORT_MAX) 672 if (klist->delkey != USHRT_MAX)
673 key_put(klist->keys[klist->delkey]); 673 key_put(klist->keys[klist->delkey]);
674 kfree(klist); 674 kfree(klist);
675} 675}
@@ -746,7 +746,7 @@ int __key_link_begin(struct key *keyring, const struct key_type *type,
746 max += klist->maxkeys; 746 max += klist->maxkeys;
747 747
748 ret = -ENFILE; 748 ret = -ENFILE;
749 if (max > USHORT_MAX - 1) 749 if (max > USHRT_MAX - 1)
750 goto error_quota; 750 goto error_quota;
751 size = sizeof(*klist) + sizeof(struct key *) * max; 751 size = sizeof(*klist) + sizeof(struct key *) * max;
752 if (size > PAGE_SIZE) 752 if (size > PAGE_SIZE)
@@ -763,7 +763,7 @@ int __key_link_begin(struct key *keyring, const struct key_type *type,
763 sizeof(struct key *) * klist->nkeys); 763 sizeof(struct key *) * klist->nkeys);
764 nklist->delkey = klist->nkeys; 764 nklist->delkey = klist->nkeys;
765 nklist->nkeys = klist->nkeys + 1; 765 nklist->nkeys = klist->nkeys + 1;
766 klist->delkey = USHORT_MAX; 766 klist->delkey = USHRT_MAX;
767 } else { 767 } else {
768 nklist->nkeys = 1; 768 nklist->nkeys = 1;
769 nklist->delkey = 0; 769 nklist->delkey = 0;