Prechádzať zdrojové kódy

secure-kernel: Add support for 5.15 kernel

Add following changes.

Fix switch case
  latest compiler throwing error where CASE statement does
  not have break or return under all the execution paths.

Rename size_add to size_add_
  There is a name collision between this one and one coming from
  overflow.h. Hence renaming it.

Modify IRQ handling for qce50 module

Change PDE_DATA to pde_data

Signed-off-by: Smita Ghosh <[email protected]>

Change-Id: I4226fb41df12273b45d2e114f1aad2709dc36eb7
Signed-off-by: Smita Ghosh <[email protected]>
Smita Ghosh 2 rokov pred
rodič
commit
0f28e48cbc

+ 2 - 4
crypto-qti/qce50.c

@@ -6278,10 +6278,8 @@ static int __qce_get_device_tree_data(struct platform_device *pdev,
 		goto err_getting_bam_info;
 	}
 
-	resource  = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (resource) {
-		pce_dev->ce_bam_info.bam_irq = resource->start;
-	} else {
+	pce_dev->ce_bam_info.bam_irq = platform_get_irq(pdev,0);
+	if (pce_dev->ce_bam_info.bam_irq < 0) {
 		pr_err("CRYPTO BAM IRQ unavailable.\n");
 		goto err_dev;
 	}

+ 2 - 2
crypto-qti/qcedev.c

@@ -2256,7 +2256,7 @@ long qcedev_ioctl(struct file *file,
 			err = -ENOTTY;
 			goto exit_free_qcedev_areq;
 		}
-		/* Fall-through */
+		fallthrough;
 	case QCEDEV_IOCTL_SHA_UPDATE_REQ:
 		{
 		struct scatterlist sg_src;
@@ -2842,6 +2842,6 @@ static void qcedev_exit(void)
 
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("QTI DEV Crypto driver");
-
+MODULE_IMPORT_NS(DMA_BUF);
 module_init(qcedev_init);
 module_exit(qcedev_exit);

+ 8 - 1
crypto-qti/qcrypto.c

@@ -1388,6 +1388,8 @@ static int _qcrypto_check_aes_keylen(struct crypto_priv *cp, unsigned int len)
 	case AES_KEYSIZE_192:
 		if (cp->ce_support.aes_key_192)
 			break;
+		else
+			return -EINVAL;
 	default:
 		//crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN);
 		return -EINVAL;
@@ -3078,8 +3080,13 @@ static int _qcrypto_aead_ccm_setkey(struct crypto_aead *aead, const u8 *key,
 	case AES_KEYSIZE_256:
 		break;
 	case AES_KEYSIZE_192:
-		if (cp->ce_support.aes_key_192)
+		if (cp->ce_support.aes_key_192) {
 			break;
+		}
+		else {
+			ctx->enc_key_len = 0;
+			return -EINVAL;
+		}
 	default:
 		ctx->enc_key_len = 0;
 		//crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN);

+ 3 - 1
hdcp/hdcp_qseecom.c

@@ -1272,8 +1272,10 @@ int hdcp2_app_comm(void *ctx, enum hdcp2_app_cmd cmd,
 		break;
 	case HDCP2_CMD_STOP:
 		rc = hdcp2_app_stop(handle);
+		break;
 	default:
-		goto error;
+		rc = -EINVAL;
+		break;
 	}
 
 	if (rc)

+ 5 - 5
smcinvoke/smcinvoke.c

@@ -882,14 +882,13 @@ static struct smcinvoke_cb_txn *find_cbtxn_locked(
 }
 
 /*
- * size_add saturates at SIZE_MAX. If integer overflow is detected,
+ * size_add_ saturates at SIZE_MAX. If integer overflow is detected,
  * this function would return SIZE_MAX otherwise normal a+b is returned.
  */
-static inline size_t size_add(size_t a, size_t b)
+static inline size_t size_add_(size_t a, size_t b)
 {
 	return (b > (SIZE_MAX - a)) ? SIZE_MAX : a + b;
 }
-
 /*
  * pad_size is used along with size_align to define a buffer overflow
  * protected version of ALIGN
@@ -905,7 +904,7 @@ static inline size_t pad_size(size_t a, size_t b)
  */
 static inline size_t size_align(size_t a, size_t b)
 {
-	return size_add(a, pad_size(a, b));
+	return size_add_(a, pad_size(a, b));
 }
 
 static uint16_t get_server_id(int cb_server_fd)
@@ -1729,7 +1728,7 @@ static size_t compute_in_msg_size(const struct smcinvoke_cmd_req *req,
 
 	/* each buffer has to be 8 bytes aligned */
 	while (i < OBJECT_COUNTS_NUM_buffers(req->counts))
-		total_size = size_add(total_size,
+		total_size = size_add_(total_size,
 				size_align(args_buf[i++].b.size,
 				SMCINVOKE_ARGS_ALIGN_SIZE));
 
@@ -2802,3 +2801,4 @@ module_exit(smcinvoke_exit);
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("SMC Invoke driver");
 MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);
+MODULE_IMPORT_NS(DMA_BUF);

+ 1 - 1
tz_log/tz_log.c

@@ -1304,7 +1304,7 @@ static ssize_t tzdbg_fs_read(struct file *file, char __user *buf,
 
 static int tzdbg_procfs_open(struct inode *inode, struct file *file)
 {
-	return single_open(file, NULL, PDE_DATA(inode));
+	return single_open(file, NULL, pde_data(inode));
 }
 
 static int tzdbg_procfs_release(struct inode *inode, struct file *file)